home *** CD-ROM | disk | FTP | other *** search
/ Over 1,000 Windows 95 Programs / Over 1000 Windows 95 Programs (Microforum) (Disc 2).iso / 1445 / bestop.doc next >
Encoding:
Text File  |  1997-04-07  |  120.0 KB  |  3,242 lines

  1. 1
  2. -
  3. -
  4. -
  5. -
  6. -
  7.                           Program Documentation
  8.                                    for
  9.                                   BESTOP
  10. -
  11. -
  12. -
  13. -
  14. -
  15. -
  16. -
  17. -
  18. 0                                          
  19.                                                   
  20.                                                       
  21. -
  22.  
  23. -
  24. -
  25.                               DATE PREPARED:
  26.                               FEBRUARY 1989
  27. 1                           TABLE_OF_CONTENTS
  28. +                           _____ __ ________
  29.  
  30. 0I.__FOREWORD                                                           1
  31. +__  ________
  32. 0II.__INTRODUCTION                                                      2
  33. +___  ____________
  34.    A.  Background                                                       2
  35.    B.  Program Control                                                  2
  36.    C.  Data Constants And Work Areas                                    4
  37. 0III.__INSTRUCTION_SPECIFICATIONS                                       7
  38. +____  ___________ ______________
  39.    A.  Instructions                                                     7
  40.    B.  Conditional Instructions                                         8
  41.      1.  IF (Character Field Comparison)                                9
  42.      2.  IF (Numeric Field Comparison)                                 10
  43.      3.  IF (Multiple Comparison)                                      10
  44.      4.  IF (character comparison)                                     11
  45.      5.  IF (Control Break)                                            12
  46.      6.  IF (Printer Line Test)                                        12
  47.      7.  IF (Condition Test)                                           12
  48.      8.  OTHERWISE                                                     13
  49.      9.  UNCONDITIONAL                                                 13
  50.    C.  Data Movement Instructions                                      14
  51.      1.  MOVE                                                          14
  52.      2.  EDIT                                                          14
  53.      3.  CLEAR                                                         15
  54.    D.  Arithmetic Instrictions                                         15
  55.      1.  ADD                                                           15
  56.      2.  SUBTRACT                                                      16
  57.      3.  MULTIPLY                                                      16
  58.      4.  DIVIDE                                                        16
  59.    E.  Output And Control Instructions                                 17
  60.      1.  WRITE (Numbered Files and Punch File)                         17
  61.      2.  WRITE (Listing with Spaces)                                   18
  62.      3.  WRITE (Listing with Skip to Numbered Line)                    18
  63.      4.  Write (Space Printer without Printing)                        18
  64.      5.  WRITE (Skip to Numbered Line without Printing)                18
  65.      6.  GET                                                           19
  66.      7.  HALT                                                          19
  67.    F.  Soubroutine Linkage Instruction                                 19
  68.      1.  SUBROUTINE                                                    20
  69.      2.  RETURN                                                        20
  70.      3.  BRANCH                                                        20
  71.    G.  Table Lookup Instructions                                       20
  72.      1.  TABLE DEFINITION                                              21
  73.      2.  TABLE ENTRY                                                   21
  74.      3.  LOOKUP                                                        21
  75.    H.  Matched File Control                                            22
  76.      1.  MATCH KEYS                                                    24
  77.    I.  Advanced Techniques                                             24
  78.      1.  FIND                                                          24
  79.      2.  MOVE (to displaced field)                                     25
  80.      3.  MOVE (from displaced field)                                   26
  81.      4.  DO AGAIN                                                      27
  82. 0IV.__PROGRAMMING_TECHNIQUES                                           29
  83. +___  ___________ __________
  84.    A.  Routines                                                        29
  85. 0
  86.                                    -i-
  87. 1  B.  Subroutines                                                     30
  88.    C.  Tables                                                          32
  89.    D.  Matched Input Files                                             34
  90.    E.  Page Format Control                                             36
  91.    F.  Summarizing Data                                                38
  92. 0V.__PROGRAM_DEBUGGING                                                 42
  93. +__  _______ _________
  94.    A.  Compilation Diagnostics                                         42
  95.    B.  Instruction Diagnostics                                         42
  96.    D.  Record Counts And File Dumps                                    44
  97.    E.  Test Runs                                                       45
  98. 0VI.__APPENDIX_A_-_OS/370_OPERATING_INSTRUCTIONS                       46
  99. +___  ________ _ _ ______ _________ ____________
  100.    A.  Job Control Language                                            46
  101.    B.  JOB Statement                                                   46
  102.    C.  EXEC Statement                                                  46
  103.    D.  STEPLIB Card                                                    47
  104.    E.  DD Statements                                                   47
  105.    F.  Completion Codes                                                48
  106.    G.  External Tables                                                 49
  107. 0VII.__APPENDIX_B_-_MAXIMUM_FIELD_SIZES                                50
  108. +____  ________ _ _ _______ _____ _____
  109. 0VIII.__APPENDIX_C_-_EIA_IMPLEMENTATIONS_OF_BESTOP                     51
  110. +_____  ________ _ _ ___ _______________ __ ______
  111.    A.  BESTOP50, BESTOPVL, BEST400                                     51
  112.    B.  SUPERB                                                          51
  113.    C.  BESTOP                                                          51
  114. -
  115. -
  116. -
  117. -
  118. -
  119. -
  120. -
  121. -
  122. -
  123. -
  124. 0
  125.                                   -ii-
  126. 1
  127.                                   BESTOP
  128.  ________________________________________________________________________
  129.  
  130.  
  131.                                I.__FOREWORD
  132. +                              __  ________
  133. 0
  134.       This document is a revised text originally written in November 1971
  135.  by   the   Office   of   Research   and   Statistics,   Social  Security
  136.  Administration.  This new documentation includes some new  features  and
  137.  other enhancements.
  138.  
  139.       This program product has performed exceedingly well for a number of
  140.  years  at  this  istallation.   But no guarantee is expressed or implied
  141.  that this program will necessarily perform in accordance with the  users
  142.  specified needs.
  143.  
  144.  
  145.  
  146. -
  147. -
  148. -
  149. -
  150. -
  151. -
  152. -
  153. -
  154. -
  155. -
  156. -
  157. -
  158.  
  159.  ________________________________________________________________________
  160.  
  161.                                    -1-
  162. 1
  163.                                   BESTOP
  164.  ________________________________________________________________________
  165.  
  166.  
  167.                             II.__INTRODUCTION
  168. +                           ___  ____________
  169. 0
  170.       A.__Background
  171. +     __  __________
  172.  
  173.       The  original  Business  Economics  Statistical  Operations Program
  174.  (BESTOP) was developed by the Office of Business Economics  (OBE),  U.S.
  175.  Department  of  Commerce, in 1965.  Since that time it has been extended
  176.  both by OBE and by other organizations to whom the program has been made
  177.  available.  The  BESTOP  language  is  the  principal  one  in  use  for
  178.  applications programming in OBE and has been used extensively by several
  179.  other  agencies  of  the Federal Government.  While there is no accurate
  180.  estimate of the number of programs that have been written in BESTOP,  it
  181.  numbers in the tens of thousands in OBE alone.
  182.  
  183.       BESTOP was developed to meet a requirement for fast turnaround on a
  184.  large number of relatively short jobs.  It has been used successfully by
  185.  programmers  and  non-programmers alike and is particularly effective in
  186.  report writing, file maintenance, and similar applications.
  187.  
  188.       The BESTOP Compiler produces an executable program in  memory  from
  189.  BESTOP  source  statements.   Machine  code  is assembled in line as the
  190.  statements are read.  The program is executed when  the  last  statement
  191.  has been processed unless an error is detected in the program.
  192.  
  193.       The  syntax  of  the  BESTOP  language permits the diagnosis of all
  194.  syntactical errors during the  translation  process.   Such  errors  are
  195.  noted  on  a  printed  listing  of  the  source  statements  and must be
  196.  corrected before the  program  can  be  executed.   A  program  that  is
  197.  syntactically  correct  is  executed.   A  program that is syntactically
  198.  correct is executed immediately and will not stop until all of the input
  199.  records have been processed or a "HALT" instruction is executed  in  the
  200.  program.   The  program will not normally "hang up" without a diagnostic
  201.  message although some care must be taken to  avoid  program  loops  when
  202.  writing subroutines.  In addition to the compilation diagnostics, record
  203.  counts  and  partial  file  dumps are produced as an aid to checking the
  204.  results of a run.
  205.  
  206.       B.__Program_Control
  207. +     __  _______ _______
  208.  
  209.       A  BESTOP  program consists of a specialized record reading routine
  210.  followed by an object program that is compiled from BESTOP  instructions
  211.  as  shown  in  figure  1.  In the execution of a program, control passes
  212.  first to the record reading routine to read a record (or two records  in
  213.  the  case  of  matched file operations), then to the object program, and
  214.  then back to the reading routine.  This  cycle  is  repeated  until  the
  215.  input  file  is exhausted or until a HALT instruction is executed in the
  216.  object program.
  217.  
  218.  
  219. 0
  220.  ________________________________________________________________________
  221.  
  222.                                    -2-
  223. 1
  224.                                   BESTOP
  225.  ________________________________________________________________________
  226.  
  227.  
  228.                              ________________
  229.                              |  Specialized |
  230.                              |    Record    |
  231.                      |------>|    Reading   |
  232.                      |       |    Routine   |
  233.                      |       |______________|
  234.                      |              |
  235.                      |              |
  236.                      |    __________v__________
  237.                      |    | Object Program    |
  238.                      |____| Produced from the |
  239.                           | Instructions Cards|
  240.                           |___________________|
  241.  
  242.  
  243.             Figure 1.  The flow of Control in a BESTOP Program
  244.  
  245.  
  246.       Not  all  of  the  instructions  will  be executed during each pass
  247.  through  the  object  program.   Conditional  instructions  permit   the
  248.  specification  of  tests  that  must  be  met  before  other  processing
  249.  instructions will be executed.  Other  non-executable  instructions  are
  250.  provided for the creation of tables and subroutines.
  251.  
  252.       The  program attempts to execute all of the processing instructions
  253.  in each pass through the object program  unless  a  GET  instruction  is
  254.  executed.   The GET instruction causes an immediate return to the record
  255.  reading routine to get the next record and processing then resumes  with
  256.  the first instruction in the program.
  257.  
  258.       After  the last input record has been processed, there is one "last
  259.  pass" through the object program to execute any instructions  that  must
  260.  be  executed at the end of the run.  Other instructions are not executed
  261.  in the last pass.
  262.  
  263.       The record reading routine is automatic and is always performed  by
  264.  the  record  reading  routine.   The  specific  file(s)  to  be  read is
  265.  specified in a job control language parameter.  If two files are  to  be
  266.  read simultaneously, a special sequence key instruction must be included
  267.  at the beginning of the program to provide routine.
  268.  
  269.       To  write  records, one or more WRITE instructions must be included
  270.  in the object program.  The WRITE  instruction  also  provides  vertical
  271.  spacing control when printing.
  272.  
  273. -
  274. -
  275.  
  276.  ________________________________________________________________________
  277.  
  278.                                    -3-
  279. 1
  280.                                   BESTOP
  281.  ________________________________________________________________________
  282.  
  283.  
  284.       C.__Data_Constants_And_Work_Areas
  285. +     __  ____ _________ ___ ____ _____
  286.  
  287.       All  of  the  data  that is processed by the object program must be
  288.  contained in tables, instruction constants, or one  of  the  work  areas
  289.  shown  in  figure 2.  Work areas of appropriate size are always provided
  290.  for input from the card reader and for data that is  to  be  punched  or
  291.  printed.   Additional  areas  may  be  used for tape or disk files.  The
  292.  length of each tape or disk area is equal to the length of  the  logical
  293.  records  in  the corresponding file.  The date area contains the current
  294.  date and time in several forms  as  shown  below.   Finally,  a  working
  295.  storage  area  of 4096 characters called "scratchpad" is provided in all
  296.  programs.
  297.  
  298.                 Code       Area in Memory
  299.  
  300.                   L        Listing Area
  301.                            132 characters
  302.  
  303.                   R        Card Reader Area
  304.                            80 characters
  305.  
  306.                   P        Card Punch Area
  307.                            80 characters
  308.  
  309.                   1-6      Numbered File Areas (up to 6)
  310.                            Length equal to record length
  311.  
  312.                   S        Scratchpad Area
  313.                            4096 characters
  314.  
  315.                   D        Date Area
  316.                            42 characters
  317.  
  318.                   V        Variable-length records
  319.                            length area.
  320.  
  321.                Figure 2. Work Areas in a BESTOP Program
  322. -     References  to  data  contained  in the work areas include the area
  323.  code, that is shown to the left of  each  area  in  figure  2,  and  the
  324.  beginning  and  ending  positions of the field within the area.  Thus, a
  325.  reference to a data field in positions 25 through 30 of the card  reader
  326.  area  would  be  "R.25.30".   The  area  codes  are  also  used in WRITE
  327.  instructions to indicate that the entire contents of an area are  to  be
  328.  written out onto the corresponding output file.
  329.  
  330.       To  illustrate,  a  program  to reproduce a deck of cards must move
  331.  each card image from the reader area to the punch area and then have the
  332.  contents of the latter area punched into a  card.   The  entire  program
  333.  consists do the following two instructions:
  334.  
  335.  ________________________________________________________________________
  336.  
  337.                                    -4-
  338. 1
  339.                                   BESTOP
  340.  ________________________________________________________________________
  341.  
  342.  
  343.                             M R.1.80 P.1.80
  344.                             W P
  345.  
  346.       The  input cards are automatically placed in the reader area by the
  347.  record reading routine.  The output area is cleared to blanks after  the
  348.  record has been written.
  349.  
  350.       Constants  are  enclosed in apostrophes and may be used in a manner
  351.  similar to data field references in many instructions.  For example,  if
  352.  a  "25"  is  to  be  punched  in  columns  79-80 of a deck of cards, the
  353.  instruction to move that number into the punch area would be:
  354.  
  355.                             M '25' P.79.80
  356.  
  357.       The use of data contained in tables is covered in section 2.
  358.  
  359.       Variable  length  records  are  read  and  written  on the basis of
  360.  information contained in file header labels, JCL and  the  program  work
  361.  area   "V".    For  variable  length  record  files,  the  size  of  the
  362.  corresponding file area (1-6) in the program is  equal  to  the  maximum
  363.  size  of  the  records in the file less the four characters required for
  364.  the record descriptor work (RDW) of the variable  length  record.   That
  365.  is,  a maximum logical record length of 156 for a variable length record
  366.  file would require an area of 152 characters in the  program  as  BESTOP
  367.  does  not  store  the  RDW  information  in  the  work area of the file.
  368.  Instead, the actual length of the records in each of the file  areas  is
  369.  stored in the appropriate positions of area "V" as follows:
  370.  
  371.  
  372.                 Locations       Actual Length of Record for
  373.  
  374.                 V.1.4                     File 1
  375.                 V.5.8                     File 2
  376.                 V.9.12                    File 3
  377.                 V.13.16                   File 4
  378.                 V.17.20                   File 5
  379.                 V.21.24                   File 6
  380.  
  381.  
  382.       For  input  files,  the  record form (RECFM), maximum record length
  383.  (LRECL) and block size (BLKSIZE) are provided by the header label of the
  384.  file and  either  fixed  length  (RECFM=FB  or  F)  or  variable  length
  385.  (RECFM=VB  or  V)  records may be read by the program.  If the record is
  386.  variable length, the actual length of  the  record,  less  the  RDW,  is
  387.  stored  by  the  program  as  a decimal integer in the appropriate field
  388.  within area V.  Positions in the input area that are not filled  by  the
  389.  input record are set to blanks.
  390.  
  391.       For  output  files,  the record form (FB,F,VB or V), maximum record
  392.  length, and block size must be provided in a data  control  block  (DCB)
  393. 0
  394.  ________________________________________________________________________
  395.  
  396.                                    -5-
  397. 1
  398.                                   BESTOP
  399.  ________________________________________________________________________
  400.  
  401.  
  402.  entry  for the file in the JCL.  For variable length records (VB,V), the
  403.  LRECL of the DCB entry must include 4 positions for the RDW.  The actual
  404.  length of a variable length record, excluding the RDW, must be stored by
  405.  the programmer in decimal integer form in the appropriate  field  within
  406.  area V before the record is written.  The contents of that field are not
  407.  affected  by  the  record  writing  operation.   A record of the maximum
  408.  length is written if the record length field in area V contains a  zero,
  409.  blanks, or non-numeric characters.
  410.  
  411.  
  412.              Locations           Date or Time
  413.  
  414.               1-18               Long form date, right justified
  415.                                  (e.g., November 25, 1971)
  416.  
  417.              19-26               Short form date, right justified
  418.                                  (e.g., 11/25/71)
  419.  
  420.              27-32               Standard form, YYMMDD
  421.                                  (e.g., 71329)
  422.  
  423.              33-37               Julian form, YYDDD
  424.                                  (e.g.), 71329)
  425.  
  426.              38-42               Starting time of run, HH:MM
  427.  
  428.  
  429.  
  430. -
  431. -
  432. -
  433. -
  434. -
  435. -
  436. -
  437. -
  438.  ________________________________________________________________________
  439.  
  440.                                    -6-
  441. 1
  442.                                   BESTOP
  443.  ________________________________________________________________________
  444.  
  445.  
  446.                      III.__INSTRUCTION_SPECIFICATIONS
  447. +                    ____  ___________ ______________
  448. 0
  449.       A.__Instructions
  450. +     __  ____________
  451.  
  452.       BESTOP instructions fall into categories as follows:
  453.  
  454.              1.   Conditional Instructions
  455.  
  456.                     I - IF
  457.                     O - OTHERWISE
  458.                     U - UNCONDITIONAL
  459.  
  460.              2.   Processing Instructions
  461.  
  462.                     M - MOVE
  463.                     E - EDIT
  464.                     C - CLEAR
  465.                     + - ADD
  466.                     - - SUBTRACT
  467.                     X - MULTIPLY
  468.                     / - DIVIDE
  469.                     W - WRITE
  470.                     G - GET
  471.                     H - HALT
  472.                     B - BRANCH
  473.                     L - LOOKUP
  474.                     F - FIND
  475.                     M - MOVE (TO DISPLACED FIELD)
  476.                     M - MOVE (FROM DISPLACED FIELD)
  477.                     D - DO AGAIN
  478.  
  479.              3.   Subroutine Definition Instructions
  480.  
  481.                     S - SUBROUTINE
  482.                     R - RETURN
  483.  
  484.              4.   Table Definition Instructions
  485.  
  486.                     T - TABLE
  487.                     constant - ENTRY
  488.  
  489.              5.   Matched File Instruction
  490.  
  491.                     K - KEYS
  492.  
  493.  
  494. -
  495. 0
  496.  ________________________________________________________________________
  497.  
  498.                                    -7-
  499. 1
  500.                                   BESTOP
  501.  ________________________________________________________________________
  502.  
  503.  
  504.       BESTOP instructions generally consist of an operation code followed
  505.  by  parameters  which  may  include field specifications, constants, and
  506.  modifiers.  The single exception to this rule is the table  entry  which
  507.  is coded as a single constant without an operation code.
  508.  
  509.       Field  specifications are of the form "f.s.e" where "f" is the file
  510.  code, "s" is the starting location, and "e" is the ending location.  For
  511.  example, the specification R.23.28 refers to positions 23 through 28  of
  512.  the  reader  area.  The ending location, with its separating period, may
  513.  be omitted for single character  fields  as  in  L.67,  a  reference  to
  514.  position 67 of the listing area.
  515.  
  516.       Constants  are  enclosed  in  apostrophes.   If  it is necessary to
  517.  include an apostrophe within a constant,  it  should  be  coded  as  two
  518.  contiguous  apostrophes.   The  compiler will omit the second apostrophe
  519.  from the resulting constant.
  520.  
  521.       Modifiers are single character parameters that are used  to  invoke
  522.  specific forms of some instructions.
  523.  
  524.       Only  one  instruction  may  be  coded  on  a  single card or line.
  525.  Instructions may be numbered by coding a decimal  number  prior  to  the
  526.  operation  code.   Comments  may  follow  an  instruction or instruction
  527.  number by coding an asterisk (*) to indicate that the remaining  portion
  528.  of  the  line  or card is a comment.  The instruction numbers, operation
  529.  code, parameters, and instruction comment must all be  separated  by  at
  530.  least one blank.  Instructions, including numbers, comments and spacing,
  531.  may not exceed 80 characters.
  532.  
  533.       Several  notation conventions have been followed in the instruction
  534.  specifications.  Operation codes and modifiers are  denoted  with  their
  535.  actual  upper  case  letters, numbers, or special characters.  The lower
  536.  case words 'field' and 'const' denote  a  field  or  constant  parameter
  537.  respectively.   A blank parameter (which may be omitted) is denoted with
  538.  the special symbol "( )".  Stacked brackets indicate  that  one  of  the
  539.  parameters in the stack should be selected.
  540.  
  541.       B.__Conditional_Instructions
  542. +     __  ___________ ____________
  543.  
  544.       The conditional instructions (IF, OTHERWISE, and UNCONDITIONAL) are
  545.  used  to start routines and to establish the conditions that must be met
  546.  before a routine will be executed.  A routine may start with one or more
  547.  "IF"  instructions  which  establish  a  set  of  conditions,  with   an
  548.  "OTHERWISE"  instruction  which  identifies  a  routine  that  is  to be
  549.  executed if the previous IF instruction routine  was  not  executed,  or
  550.  with  the  UNCONDITIONAL  instruction which is needed to start a routine
  551.  that will be executed  unconditionally  following  an  IF  or  OTHERWISE
  552.  routine.  IF, OTHERWISE and UNCONDITIONAL instructions may never be used
  553.  together within a single routine.  The OTHERWISE instruction may only be
  554.  used  to  start  a  routine that immediately follows an IF routine.  The
  555. 0
  556.  ________________________________________________________________________
  557.  
  558.                                    -8-
  559. 1
  560.                                   BESTOP
  561.  ________________________________________________________________________
  562.  
  563.  
  564.  UNCONDITIONAL instruction is only used immediately after IF or OTHERWISE
  565.  routines and is not used at the start of a  program  or  subroutine,  or
  566.  immediately following a subroutine or table.
  567.  
  568.       The  various  forms  of  the  IF  instruction  end with the linking
  569.  modifiers A,O, or blank for "and", "or" and "no link"  respectively.   A
  570.  linking  modifier  specifies  the  relationship  between  the current IF
  571.  instruction and the IF instruction that follows.  It must be left  blank
  572.  if the next instruction is not an IF instruction.
  573.  
  574.       When both "and" and "or" links are used as modifiers in a set of IF
  575.  instructions,  the  "and"  links  take  precedence  over the "or" links.
  576.  Thus, in a set of condition instructions with tests X, Y, and Z that are
  577.  linked as follows:
  578.  
  579.                                   X and Y or Z,
  580.  
  581.       the  correct  interpretation  is as though parenthesis were used to
  582.  group the tests as:
  583.  
  584.                                  (X and Y) or Z
  585.  
  586.       and not as:
  587.  
  588.                                   X and (Y or Z)
  589.  
  590.  
  591.  1.__IF_(Character_Field_Comparison)
  592. +__  __ __________ _____ ___________
  593.  
  594.  ------------------------------------------------------------------------
  595.                              (E)            (A)
  596.                    I  field  (G)   (field)  (O)
  597.                              (L)   (const)  ( )
  598.                              (U)
  599.  ------------------------------------------------------------------------
  600.  
  601.  
  602.  
  603.       The  contents  of  the first field are compared with the second for
  604.  the relationship specified by the first modifier as follows:
  605.  
  606.                   E - first equals second
  607.                   G - first is greater than second
  608.                   L - first is less than second
  609.                   U - first is unequal to second
  610.  
  611.       The  two  fields  must be the same size.  The comparison is made on
  612.  character for character basis from  left  to  right  until  two  unequal
  613.  characters are compared on the fields are exhausted.
  614.  
  615. 0
  616.  ________________________________________________________________________
  617.  
  618.                                    -9-
  619. 1
  620.                                   BESTOP
  621.  ________________________________________________________________________
  622.  
  623.  
  624.  2.__IF_(Numeric_Field_Comparison)
  625. +__  __ ________ _____ ___________
  626.  
  627.  ------------------------------------------------------------------------
  628.                              (E)            (A)
  629.                   I N field  (G)  (field)   (O)
  630.                              (L)  (const)   ( )
  631.                              (U)
  632.  ------------------------------------------------------------------------
  633.  
  634.  
  635.       The  numeric  values of the contents of the two fields are compared
  636.  for the relationship specified by the second modifier as follows:
  637.  
  638.                   E - first equals second
  639.                   G - first is greater than second
  640.                   L - first is less than second
  641.                   U - first is unequal to second
  642.  
  643.  
  644.       The  fields need not be the same size since it is the numeric value
  645.  and not the character values of the two fields that  are  compared.   In
  646.  the  numeric  comparison, values are ranked from plus infinity (high) to
  647.  minus infinity (low).  Blanks are equivalent to  zeros.   The  digits  0
  648.  through  9,  blanks  and  minus  signs  are the only characters that may
  649.  appear in a field or constant used in a numeric comparison.
  650.  
  651.         Example
  652.  
  653.         Test  the contents of file 1 positions 12-19 for a
  654.         value greater than zero.
  655.  
  656.                        I N 1.12.19 G '0'
  657.  
  658.  
  659.  3.__IF_(Multiple_Comparison)
  660. +__  __ _________ ___________
  661.  
  662.  ------------------------------------------------------------------------
  663.                              (E)            (A)
  664.                   I M field  (U)   const    (O)
  665.                                             ( )
  666.  ------------------------------------------------------------------------
  667.  
  668.  
  669.       The  field  is  compared  against a list of values specified in the
  670.  constant on a character by character basis.  Each value in the  constant
  671.  must  have  the  same length as the field.  Individual comparison values
  672.  within the constant must be  separated  by  commas  or  dashes  and  not
  673.  blanks.   However,  blanks  may  be  included  in the comparison values.
  674.  Commas in the constant separate discrete values while a dash indicates a
  675.  range of values whose limits are specified by the two values  joined  by
  676.  the dash.
  677.  
  678.  ________________________________________________________________________
  679.  
  680.                                    -10-
  681. 1
  682.                                   BESTOP
  683.  ________________________________________________________________________
  684.  
  685.  
  686.       When  the  second  modifier is an "E", the test is satisfied if the
  687.  contents of the field are identical to any of the values in the list  or
  688.  if  they  fall  within  a  range specified in the list.  When the second
  689.  modifier is a "U", the test is satisfied only if  the  contents  of  the
  690.  field are not identical to any of the values in the list and do not fall
  691.  within a range specified in the list.
  692.  
  693.         Examples
  694.  
  695.         Test  the  code  in  reader  positions 8-9 for the
  696.         values 05, 09, or 16 or a value in the range  from
  697.         25 to 29.
  698.  
  699.                      I M R.8.9  E '05,09,16,25-29'
  700.  
  701.         Test  the  code  in file 1 position 15 for a value
  702.         that is not equal to a blank, 2,  or  9  and  that
  703.         does not fall in the range from 4 to 7.
  704.  
  705.                      I M 1.15  U  ' ,2,4-7,9'
  706.  
  707.  
  708.  4.__IF_(character_comparison)
  709. +__  __ __________ ___________
  710.  
  711.  
  712.  ------------------------------------------------------------------------
  713.                        I C field (E) const
  714.                                  (U)
  715.  ------------------------------------------------------------------------
  716.  
  717.       Each individual character in the field is tested against the set of
  718.  characters  contained  in  the constant for the equal (E) or unequal (U)
  719.  relationship specified in the instruction.  The equal test is met if all
  720.  of the characters in the field are found in the constant.   The  unequal
  721.  test  is  met if any of the characters in the field are missing from the
  722.  constant.
  723.  
  724.         Example
  725.  
  726.         Set  the contents of 1.6.9 to blank if it contains
  727.         non-numeric characters.
  728.  
  729.                       I C 1.6.9 U '0123456789'
  730.                       C 1.6.9 ' '
  731.  
  732. -
  733. -
  734.  
  735.  ________________________________________________________________________
  736.  
  737.                                    -11-
  738. 1
  739.                                   BESTOP
  740.  ________________________________________________________________________
  741.  
  742.  
  743.  5.__IF_(Control_Break)
  744. +__  __ ________ ______
  745.  
  746.  ------------------------------------------------------------------------
  747.                                  (A)
  748.                        I field   (0)
  749.                                  ( )
  750.  ------------------------------------------------------------------------
  751.  
  752.  
  753.       The  contents  of  the  field are compared with the contents of the
  754.  same field at the time of the last testing of  the  conditions  for  the
  755.  current  routine.   The  test is satisfied if there has been a change in
  756.  the contents.  It is never satisfied the first time that it is  executed
  757.  as  there  is  no  basis  for  a  comparison.  A control break is always
  758.  satisfied on the last pass to permit the processing of group totals  and
  759.  similar end of group results.
  760.  
  761.  
  762.  6.__IF_(Printer_Line_Test)
  763. +__  __ ________ ____ _____
  764.  
  765.  ------------------------------------------------------------------------
  766.                             (E)          (A)
  767.                       I C   (G)  const   (0)
  768.                             (L)          ( )
  769.                             (U)
  770.  ------------------------------------------------------------------------
  771.  
  772.  
  773.       The contents of the printer line counter are compared against a two
  774.  digit  zero filled constant for the relationship specified by the second
  775.  modifier as follows:
  776.  
  777.              E - counter equals constant
  778.              G - counter is greater than constant
  779.              L - counter is less than constant
  780.              U - counter is unequal to constant
  781.  
  782.  
  783.  7.__IF_(Condition_Test)
  784. +__  __ __________ _____
  785.  
  786.  ------------------------------------------------------------------------
  787.                          (M)  (A)
  788.                       I  (A)  (0)
  789.                          (B)  ( )
  790.                          (S)
  791.                          (F)
  792.  ------------------------------------------------------------------------
  793.  
  794.  
  795.       This  instruction  tests  for  condition  specified  by  the  first
  796.  modifier as follows:
  797.  
  798.  ________________________________________________________________________
  799.  
  800.                                    -12-
  801. 1
  802.                                   BESTOP
  803.  ________________________________________________________________________
  804.  
  805.  
  806.         M  - Matching records were read from the two input
  807.         files under matched file control.
  808.  
  809.         A - There is an unmatched record  in  the  A  file
  810.         that was read under matched file control.
  811.  
  812.         B  -  There  is  an unmatched record in the B file
  813.         that was read under matched file control.
  814.  
  815.         S - Start of run, the  first  record(s)  is  being
  816.         processed.
  817.  
  818.         F  -  Finish  of run,  the last record(s) has been
  819.         processed and the program is in the last pass.
  820.  
  821.  
  822.  8.__OTHERWISE
  823. +__  _________
  824.  
  825.  ------------------------------------------------------------------------
  826.                                 O
  827.  ------------------------------------------------------------------------
  828.  
  829.  
  830.       The  OTHERWISE  instructions is used to start a routine that should
  831.  be executed if the conditions set forth  for  the  immediately  previous
  832.  routine  were  not met.  It may only be used after a routine that begins
  833.  with an IF instruction.
  834.  
  835.  
  836.  9.__UNCONDITIONAL
  837. +__  _____________
  838.  
  839.  ------------------------------------------------------------------------
  840.                                 U
  841.  ------------------------------------------------------------------------
  842.  
  843.  
  844.       The UNCONDITIONAL instruction is used to end the routine associated
  845.  with  the  previous  set  of  condition  instructions and to start a new
  846.  routine that will be executed unconditionally.
  847. -
  848. -
  849. -
  850. -
  851.  
  852.  ________________________________________________________________________
  853.  
  854.                                    -13-
  855. 1
  856.                                   BESTOP
  857.  ________________________________________________________________________
  858.  
  859.  
  860.       C.__Data_Movement_Instructions
  861. +     __  ____ ________ ____________
  862.  
  863.       The basic data movement instructions are the MOVE, EDIT, and CLEAR.
  864.  The  MOVE  instruction moves data from one field to another in memory or
  865.  moves a constant into a field.  The EDIT instruction moves data from one
  866.  field to another and  inserts  any  necessary  punctuation.   The  CLEAR
  867.  instruction  fills a field with any desired character and can be use for
  868.  such operations as clearing counters or drawing lines of dashes across a
  869.  page.
  870.  
  871.  1.__MOVE
  872. +__  ____
  873.  
  874.  ------------------------------------------------------------------------
  875.                         M    (field)  field
  876.                              (const)
  877.  ------------------------------------------------------------------------
  878.  
  879.  
  880.       The  contents  of the first field (or constant) are copied into the
  881.  positions specified by the second  field.   The  sending  and  receiving
  882.  fields must have the same length.
  883.  
  884.  2.__EDIT
  885. +__  ____
  886.  
  887.  ------------------------------------------------------------------------
  888.                         E  field  field  const
  889.  ------------------------------------------------------------------------
  890.  
  891.  
  892.       The  contents  of  the  first  field  are  edited  with the symbols
  893.  contained in the constant and placed in  the  second  field.   Zeros  or
  894.  blanks  in the constant are replaced by characters from the first field.
  895.  All other characters in the constant will appear in  the  same  relative
  896.  positions  within  the  second  field.  A zero in the constant indicates
  897.  that leading zeros should appear in any blank positions to the right  of
  898.  and  including the zero position and that leading commas in the constant
  899.  to the left of the zero should be suppressed.  Blanks are  used  in  the
  900.  remaining  positions  of  the  constant corresponding to positions to be
  901.  occupied by data from the first field.  The length of the constant  must
  902.  be  equal  to  the  length of the second field and should contain enough
  903.  replaceable blanks and zeros to accommodate the characters of the  first
  904.  field.
  905.  
  906.       This operation may only be performed on numeric data.
  907.  
  908.         Examples
  909.  
  910.         Read  area positions 31-39 contain a dollar amount
  911.         expressed to the nearest hundredth  of  a  dollar.
  912.         Edit  the field to insert commas and decimal point
  913. 0
  914.  ________________________________________________________________________
  915.  
  916.                                    -14-
  917. 1
  918.                                   BESTOP
  919.  ________________________________________________________________________
  920.  
  921.  
  922.         where appropriate and place the edited  result  in
  923.         listing positions 42-53.
  924.  
  925.                    E R.31.39  L.42.53   ',   ,  .0 '
  926.  
  927.         Zero  fill  the  contents of file 1 positions 8-12
  928.         and place the result in file 2 positions 1-5
  929.  
  930.                    E 1.8.12  2.1.5  '0    '
  931.  
  932.  
  933.  3.__CLEAR
  934. +__  _____
  935.  
  936.  ------------------------------------------------------------------------
  937.                        C  field const
  938.  ------------------------------------------------------------------------
  939.  
  940.  
  941.       All  of  the  positions  in the specified field are filled with the
  942.  single character specified by the constant.
  943.  
  944.         Example
  945.  
  946.         Draw  a line of dashes across the next line of the
  947.         listing.
  948.  
  949.                         C L.1.132 '-'
  950.  
  951.       D.__Arithmetic_Instrictions
  952. +     __  __________ ____________
  953.  
  954.       The  arithmetic  instructions  are the ADD, SUBTRACT, MULTIPLY, and
  955.  DIVIDE.
  956.  
  957.       Arithmetic operations may be  performed  on  positive  or  negative
  958.  data.   Minus  signs,  if  any, must be carried to the left of the first
  959.  significant digit in a field.  Positive or  zero  data  should  be  left
  960.  unsigned;  the  positive  or zero results of any computations are always
  961.  unsigned.  All arithmetic operations are algebraic, i.e., the  signs  of
  962.  any data items used in a computation are taken into account.
  963.  
  964.  1.__ADD
  965. +__  ___
  966.  
  967.  ------------------------------------------------------------------------
  968.                        +    (field)  field
  969.                             (const)
  970.  ------------------------------------------------------------------------
  971.  
  972.       The contents of the first field or constant are added to the second
  973.  field.  The result replaces the second field.
  974.  
  975. 0
  976.  ________________________________________________________________________
  977.  
  978.                                    -15-
  979. 1
  980.                                   BESTOP
  981.  ________________________________________________________________________
  982.  
  983.  
  984.       The  width  of  the first field or constant must not be larger than
  985.  the width of the second field.
  986.  
  987.  2.__SUBTRACT
  988. +__  ________
  989.  
  990.  ------------------------------------------------------------------------
  991.                        -    (field)  field
  992.                             (const)
  993.  ------------------------------------------------------------------------
  994.  
  995.       The contents of the first field or constant are subtracted from the
  996.  second field.  The result replaces the second field.
  997.  
  998.       The  width  of  the first field or constant must not be larger than
  999.  that of the second field.
  1000.  
  1001.  
  1002.  3.__MULTIPLY
  1003. +__  ________
  1004.  
  1005.  ------------------------------------------------------------------------
  1006.                        X  field  (field)  (0-9)  field
  1007.                                  (const)
  1008.  ------------------------------------------------------------------------
  1009.  
  1010.       The  first field is multiplied by the second or by the constant and
  1011.  the rounded result is placed in  the  third  field.   The  single  digit
  1012.  modifier  indicates  the  number of digits that will be rounded from the
  1013.  result.
  1014.  
  1015.         Example
  1016.  
  1017.         Multiply the contents of read area positions 11-17
  1018.         by  read  area  positions 18-23.  Round the result
  1019.         three places and place  it  in  file  1  positions
  1020.         21-30.
  1021.  
  1022.                    X R.11.17  R.18.23  3  1.21.30
  1023.  
  1024.  
  1025.  4.__DIVIDE
  1026. +__  ______
  1027.  
  1028.  ------------------------------------------------------------------------
  1029.                        /  field  (field)   (0-9) field
  1030.                                  (const)
  1031.  ------------------------------------------------------------------------
  1032.  
  1033.  
  1034.       The first field is divided by the second or by the constant and the
  1035.  result  is  placed in the third field.  Prior to the division operation,
  1036.  the first field is extended by the number  of  zeros  specified  in  the
  1037.  modifier to obtain greater precision.
  1038.  
  1039.  ________________________________________________________________________
  1040.  
  1041.                                    -16-
  1042. 1
  1043.                                   BESTOP
  1044.  ________________________________________________________________________
  1045.  
  1046.  
  1047.       The  value  of  the  precision  modifier can be calculated from the
  1048.  following formula for fields with implied decimal locations:
  1049.  
  1050.         Modifier = B - A + C    where:
  1051.  
  1052.         B  =  the implicit number of decimal places in the
  1053.         divisor,
  1054.         A  =  the implicit number of decimal places in the
  1055.         dividend, and,
  1056.         C = the implicit number of decimal places required
  1057.         in the result.
  1058.  
  1059.  
  1060.         Example
  1061.  
  1062.         The  total income in dollars for a group of people
  1063.         is contained in file 1  positions  35-44  and  the
  1064.         number of people in the group is contained in file
  1065.         1 positions 51-56.  Compute the per capita income
  1066.         to the nearest hundredth of a dollar and place the
  1067.         result in file 2 positions 11-16.
  1068.  
  1069.                  / 1.35.33   1.51.56   2  2.11.16
  1070.  
  1071.  
  1072.  
  1073.       E.__Output_And_Control_Instructions
  1074. +     __  ______ ___ _______ ____________
  1075.  
  1076.       The  output  and control instructions are the WRITE, GET, and HALT.
  1077.  The WRITE instruction is used to write records from the  various  output
  1078.  areas  of  the program.  It is also used to control the vertical spacing
  1079.  of the  printer.   There  is  no  record  reading  instruction  as  that
  1080.  operation  is performed by the record reading routine.  However, the GET
  1081.  instruction will cause an immediate return to the record reading routine
  1082.  to get and process the  next  record  without  executing  any  remaining
  1083.  instructions in the program on the current record.  The HALT instruction
  1084.  may be used to stop the program before the end of the input file(s).
  1085.  
  1086.  1.__WRITE_(Numbered_Files_and_Punch_File)
  1087. +__  _____ _________ _____ ___ _____ _____
  1088.  
  1089.  ------------------------------------------------------------------------
  1090.                              W    (1-6)
  1091.                                   (P)
  1092.  ------------------------------------------------------------------------
  1093.  
  1094.       A  record is written from the specified output area and the area is
  1095.  cleared to blanks.
  1096. -
  1097. 0
  1098.  ________________________________________________________________________
  1099.  
  1100.                                    -17-
  1101. 1
  1102.                                   BESTOP
  1103.  ________________________________________________________________________
  1104.  
  1105.  
  1106.  2.__WRITE_(Listing_with_Spaces)
  1107. +__  _____ ________ ____ _______
  1108.  
  1109.  ------------------------------------------------------------------------
  1110.                              W L  (1-9)
  1111.                                   (H)
  1112.  ------------------------------------------------------------------------
  1113.  
  1114.       A  line  is  printed  with the contents of the listing area and the
  1115.  area is cleared to blanks.  The printer is spaced from 1 to 9  lines  or
  1116.  to the head of form (H).
  1117.  
  1118.  3.__WRITE_(Listing_with_Skip_to_Numbered_Line)
  1119. +__  _____ ________ ____ ____ __ ________ _____
  1120.  
  1121.  ------------------------------------------------------------------------
  1122.                              W L S const
  1123.  ------------------------------------------------------------------------
  1124.  
  1125.  
  1126.       A  line  is  printed  with the contents of the listing area and the
  1127.  area is cleared to blanks.  The printer skips to the line  specified  in
  1128.  the two digit zero-filled constant after printing the line.
  1129.  
  1130.         Example
  1131.  
  1132.         Write a line and skip to line 52.
  1133.  
  1134.                       W L S '52'
  1135.  
  1136.  
  1137.  4.__Write_(Space_Printer_without_Printing)
  1138. +__  _____ ______ _______ _______ _________
  1139.  
  1140.  ------------------------------------------------------------------------
  1141.                             W S  (1-9)
  1142.                                   (H)
  1143.  ------------------------------------------------------------------------
  1144.  
  1145.  
  1146.       The  printer is spaced from 1 to 9 lines or to the head of form (H)
  1147.  without printing a line.   The  contents  of  the  listing  area  remain
  1148.  unchanged.
  1149.  
  1150.  
  1151.  5.__WRITE_(Skip_to_Numbered_Line_without_Printing)
  1152. +__  _____ _____ __ ________ ____ _______ _________
  1153.  
  1154.  ------------------------------------------------------------------------
  1155.                              W S const
  1156.  ------------------------------------------------------------------------
  1157.  
  1158.  
  1159. -
  1160.  ________________________________________________________________________
  1161.  
  1162.                                    -18-
  1163. 1
  1164.                                   BESTOP
  1165.  ________________________________________________________________________
  1166.  
  1167.  
  1168.       The  printer  is  skipped  to  the  line specified in the two digit
  1169.  zero-filled constant without printing  a  line.   The  contents  of  the
  1170.  listing area remain unchanged.
  1171.  
  1172.  6.__GET
  1173. +__  ___
  1174.  
  1175.  ------------------------------------------------------------------------
  1176.                                   G
  1177.  ------------------------------------------------------------------------
  1178.  
  1179.       The  processing  of  the  current  record(s)  is terminated and the
  1180.  program makes an immediate return to the record reading routine  to  get
  1181.  the  next  record(s).   Processing resumes with the first instruction in
  1182.  the program.
  1183.  
  1184.  7.__HALT
  1185. +__  ____
  1186.  
  1187.  ------------------------------------------------------------------------
  1188.                               H  (R)
  1189.                                  (J)
  1190.  ------------------------------------------------------------------------
  1191.  
  1192.       The  current run or step (R) or the entire job (J) is terminated as
  1193.  specified by the modifier.  In terminating the run, the program executes
  1194.  the last pass and closes all input and output files before returning  to
  1195.  the operating system.
  1196.  
  1197.  
  1198.       F.__Soubroutine_Linkage_Instruction
  1199. +     __  ___________ _______ ___________
  1200.  
  1201.       Subroutines  may  be  included  in  BESTOP  programs  by  using the
  1202.  SUBROUTINE instruction to identify the subroutine and following it  with
  1203.  the  routine(s)  that  are  to  be  included  in  the  subroutine.   The
  1204.  subroutine is terminated by  a  RETURN  instruction.   A  subroutine  is
  1205.  executed  with  a  BRANCH  instruction.   After  the subroutine has been
  1206.  executed, control returns to the instruction following the BRANCH.
  1207.  
  1208.       Subroutines may not be defined within  other  subroutines  although
  1209.  they  may  contain branches to other subroutines.  Care must be taken to
  1210.  avoid constructing a string of branches which includes a branch back  to
  1211.  a  subroutine  earlier  in the string.  Such a sequence will destroy the
  1212.  return linkage back to the calling routine.
  1213.  
  1214.       A subroutine may only be entered with a branch instruction.  It  is
  1215.  skipped  when  encountered  in the normal execution of the routines in a
  1216.  program.  Any number of branches may be made to the same subroutine.
  1217. -
  1218. -
  1219.  ________________________________________________________________________
  1220.  
  1221.                                    -19-
  1222. 1
  1223.                                   BESTOP
  1224.  ________________________________________________________________________
  1225.  
  1226.  
  1227.  1.__SUBROUTINE
  1228. +__  __________
  1229.  
  1230.  ------------------------------------------------------------------------
  1231.                              S    (1-9)
  1232.                                   (A-Z)
  1233.  ------------------------------------------------------------------------
  1234.  
  1235.       A  subroutine is started which is identified by the single digit or
  1236.  letter specified  in  the  modifier.   All  instructions  following  the
  1237.  SUBROUTINE  instruction  up to the final RETURN instruction are included
  1238.  in the subroutine.
  1239.  
  1240.  2.__RETURN
  1241. +__  ______
  1242.  
  1243.  ------------------------------------------------------------------------
  1244.                              R    (C)
  1245.                                   ( )
  1246.  ------------------------------------------------------------------------
  1247.  
  1248.       A  return  is  made  to the instruction following the branch to the
  1249.  subroutine.  If the modifier is omitted, the subroutine  is  terminated.
  1250.  The  modifier  "C"  indicates that the instructions following the RETURN
  1251.  are to be included in the  subroutine  until  a  terminating  RETURN  is
  1252.  encountered, that is a subroutine may have multiple returns.
  1253.  
  1254.  3.__BRANCH
  1255. +__  ______
  1256.  
  1257.  ------------------------------------------------------------------------
  1258.                              B    (1-9)
  1259.                                   (A-Z)
  1260.  ------------------------------------------------------------------------
  1261.  
  1262.       A  branch  is  made  to  the subroutine identified by the modifier.
  1263.  Control returns to  the  instruction  following  the  branch  after  the
  1264.  subroutine has been executed.
  1265.  
  1266.  
  1267.       G.__Table_Lookup_Instructions
  1268. +     __  _____ ______ ____________
  1269.  
  1270.       A  table  lookup may be used to obtain a title, code, or other item
  1271.  that corresponds to a value shown in a table.  It is  useful  in  coding
  1272.  and recoding data and in translating codes into titles.  A table is made
  1273.  up  of a number of constant width entries.  Each entry has two parts, an
  1274.  argument, the test value, and the result, the code or title to which the
  1275.  argument corresponds.  A table  is  defined  with  a  TABLE  instruction
  1276.  followed  by  the  entires  of  the table.  It is searched with a LOOKUP
  1277.  instruction.
  1278.  
  1279.       In the lookup operation, a program argument in a specified field is
  1280.  tested against the arguments of the table and a result corresponding  to
  1281. 0
  1282.  ________________________________________________________________________
  1283.  
  1284.                                    -20-
  1285. 1
  1286.                                   BESTOP
  1287.  ________________________________________________________________________
  1288.  
  1289.  
  1290.  the  table  argument that meets the specified lookup test is stored in a
  1291.  result field.  The program argument and result fields are  specified  in
  1292.  the  TABLE  instruction.   The  lookup  test  is specified in the LOOKUP
  1293.  instruction.  The result field is cleared to blanks if there is no table
  1294.  argument that meets the lookup test.
  1295.  
  1296.  1.__TABLE_DEFINITION
  1297. +__  _____ __________
  1298.  
  1299.  ------------------------------------------------------------------------
  1300.                         T    (1-9)  field  field
  1301.                              (A-Z)
  1302.  ------------------------------------------------------------------------
  1303.  
  1304.       A  table  is  created  and identified by the single digit or letter
  1305.  specified in the modifier.  The first field specifies  the  location  of
  1306.  the  lookup  argument;  the second specifies the location into which the
  1307.  result will be placed.
  1308.  
  1309.       The entries of the table follow the TABLE instruction.  The  length
  1310.  of  each  entry  must be equal to the sum of the lengths of the argument
  1311.  and result fields.
  1312.  
  1313.  2.__TABLE_ENTRY
  1314. +__  _____ _____
  1315.  
  1316.  ------------------------------------------------------------------------
  1317.                                 const
  1318.  ------------------------------------------------------------------------
  1319.  
  1320.       A  table  entry  is  generated  from  the  specified constant.  The
  1321.  leftmost portion of the constant is assumed to be the table argument and
  1322.  the rightmost is assumed to be the table result.   The  lengths  of  the
  1323.  table  argument  and  result  portions of the constant are assumed to be
  1324.  equal to the lengths of the argument and result fields specified in  the
  1325.  TABLE instruction
  1326.  
  1327.  
  1328.  3.__LOOKUP
  1329. +__  ______
  1330.  
  1331.  ------------------------------------------------------------------------
  1332.                          L  (1-9)   (E)
  1333.                             (A-Z)   (L)
  1334.                                     (H)
  1335.  ------------------------------------------------------------------------
  1336.  
  1337.       A  search  is made of the table specified in the first modifier for
  1338.  the entry which meets the test  specified  by  the  second  modifier  as
  1339.  follows:
  1340.  
  1341.         E    -  Lookup  equal,  the  program will select a
  1342.         table entry only if the argument in the entry   is
  1343. 0
  1344.  ________________________________________________________________________
  1345.  
  1346.                                    -21-
  1347. 1
  1348.                                   BESTOP
  1349.  ________________________________________________________________________
  1350.  
  1351.  
  1352.         equal  to  the contents of  the  program  argument
  1353.         specified in the TABLE instruction.  If the  table
  1354.         argument   is  equal to the program argument , the
  1355.         table result  is  stored   in  the  result   field
  1356.         specified   in  the TABLE instruction.  The result
  1357.         area is cleared to blanks if there  is  no   equal
  1358.         entry.
  1359.  
  1360.         L - Lookup low or equal, the program searches  for
  1361.         the  entry  whose argument is the highest of those
  1362.         with arguments lower than or equal to the  program
  1363.         argument  and the corresponding result is moved to
  1364.         the result field.  The result field is cleared  to
  1365.         blanks  if  there  are  no  entries  in  which the
  1366.         argument is lower than or  equal  to  the  program
  1367.         argument.
  1368.  
  1369.  
  1370.         H - Lookup high or equal, the program searches for
  1371.         the  entry  whose  argument is the lowest of those
  1372.         entries with arguments higher than or equal to the
  1373.         program argument and the corresponding  result  is
  1374.         moved  to  the  result field.  The result field is
  1375.         cleared to blanks if there are no entries in which
  1376.         the argument  is  higher  than  or  equal  to  the
  1377.         program argument.
  1378.  
  1379.  
  1380.       H.__Matched_File_Control
  1381. +     __  _______ ____ _______
  1382.  
  1383.       A  program will read two input files when the necessary information
  1384.  is  provided  to  further  specialize  the   record   reading   routine.
  1385.  Otherwise,  a  program is limited to one input file.  Both files must be
  1386.  sorted on an identical set of sequence  keys  although  these  keys  may
  1387.  occupy  different  positions  in  the  records  of  the  two files.  For
  1388.  identification purposes, one file is designated the A file and the other
  1389.  is designated the B file.
  1390.  
  1391.       The record reading  routine  compares  the  sequence  keys  in  the
  1392.  current  records  from  each  file  and  sets one of the following three
  1393.  indicators:
  1394.  
  1395.         M  -  The  records  in  the two files are matching
  1396.         records.
  1397.  
  1398.         A  -  There is a record in the A file which is not
  1399.         matched in the B file, i.e., the value of the keys
  1400.         in the current A file record is less than that for
  1401.         the current B file record.
  1402.  
  1403. 0
  1404.  ________________________________________________________________________
  1405.  
  1406.                                    -22-
  1407. 1
  1408.                                   BESTOP
  1409.  ________________________________________________________________________
  1410.  
  1411.  
  1412.         B  -  There is a record in the B file which is not
  1413.         matched in the A file, i.e., the value of the keys
  1414.         in the current B file record is less than that for
  1415.         the current A file record.
  1416.  
  1417.       These  indicators may be tested with the condition test form of the
  1418.  "IF" instruction.
  1419.  
  1420.       Subsequent record reading operations are controlled by the previous
  1421.  setting of the above indicators and the "run type." The run  type  codes
  1422.  are the following:
  1423.  
  1424.         1  - There should be one record in file A for each
  1425.         record in file B.  If  either  file  contains  two
  1426.         records with the same values in the sequence keys,
  1427.         the  program  will  treat  the second record as an
  1428.         unmatched record.
  1429.  
  1430.         2  -  There  may be more than one record in file B
  1431.         for each file A record.  However, there should  be
  1432.         no  more  than  one  file A record for each file B
  1433.         record.  Thus, duplicate file B  records  will  be
  1434.         treated  as  matches  for  a  single file A record
  1435.         while duplicate file A records will be treated  as
  1436.         unmatched records.
  1437.  
  1438.       A  record  from  the  A  file  is always read by the record reading
  1439.  routine if the A indicator was set after the last reading operation.   A
  1440.  record  from  the  B file is always read if the B indicator was set.  If
  1441.  the M indicator was set and the run type is "1", both an A and a B  file
  1442.  record  are read before they are compared and an indicator is set on the
  1443.  basis of that comparison.  If the M indicator was set and the  run  type
  1444.  is  "2", a B file record is read first and compared with existing A file
  1445.  record.  The M indicator is then set if they  match.   If  they  do  not
  1446.  match, an A file record is read and the comparison is repeated before an
  1447.  indicator is set.
  1448.  
  1449.       At  the  end  of  the  record  reading operation the current A file
  1450.  record will appear in the memory area corresponding to the A  file  code
  1451.  and   the  current  B  file  record  will  appear  in  the  memory  area
  1452.  corresponding to the B file code.  If either file  has  been  exhausted,
  1453.  the  corresponding  area  will  be  filled with padding (the hexadecimal
  1454.  character FF).
  1455.  
  1456.       Up to five sequence keys may be used in the record comparison.  The
  1457.  locations of these keys in major to minor order for the records in  each
  1458.  of  the  two files is specified in a KEYS instruction.  The run type and
  1459.  the  A  file  and  B  file  specifications  are  job  control   language
  1460.  parameters.
  1461.  
  1462.  
  1463.  
  1464.  ________________________________________________________________________
  1465.  
  1466.                                    -23-
  1467. 1
  1468.                                   BESTOP
  1469.  ________________________________________________________________________
  1470.  
  1471.  
  1472.  1.__MATCH_KEYS
  1473. +__  _____ ____
  1474.  
  1475.  ------------------------------------------------------------------------
  1476.           K  field field  (field field). . .(field field)
  1477.  ------------------------------------------------------------------------
  1478.  
  1479.       The KEYS instruction specifies up to five pairs of sequence keys in
  1480.  the  records  of  the  A and B files that establish the order of the two
  1481.  files.  The first field  in  each  pair  specifies  the  location  of  a
  1482.  sequence  key in the A file records while the second field specifies the
  1483.  location in the B file records.  The  order  of  the  pairs  within  the
  1484.  instruction  must  be  a  major  to minor.  The widths of the two fields
  1485.  within a pair must be equal although different pairs may have  different
  1486.  widths  and  the  actual locations of the keys within the records of the
  1487.  two files need not be the same.
  1488.  
  1489.  
  1490.       I.__Advanced_Techniques
  1491. +     __  ________ __________
  1492.  
  1493.       Several  instructions  are available that emulate array processing.
  1494.  The  first  three  instructions  use  a  displacement  field  in   their
  1495.  operations.    It   provides   a   capability  similar  to  indexing  or
  1496.  subscripting in other languages.  The displacement is a  1  to  4  digit
  1497.  number  that  specifies  a character location within a field in terms of
  1498.  the number of characters between the specified character and  the  first
  1499.  character  of  the  field.   For  example,  the displacement of the 25th
  1500.  character of a field is 24 as it is  displaced  24  character  positions
  1501.  from  the 1st character.  The displacement itself is stored in a field 1
  1502.  to 4 characters long and is always preceded by the  modifier  "D".   For
  1503.  example, a displacement stored in scratchpad positions 22 to 25 would be
  1504.  expressed in the form:
  1505.                            D   S.22.25
  1506.       The  "DO  AGAIN" instriction provides the capability similar to the
  1507.  DO WHILE of PL/1.
  1508.  
  1509.  
  1510.  
  1511.  1.__FIND
  1512. +__  ____
  1513.  
  1514.  ------------------------------------------------------------------------
  1515.                     F   (field)   field  D  field
  1516.                         (const)
  1517.  ------------------------------------------------------------------------
  1518.  
  1519.       The  second  field  is  searched  for  a  character  string that is
  1520.  identical to the contents of the first (or constant).  The  displacement
  1521.  of  the  first  character of the found string within the second field is
  1522.  placed in the third field.  The third field is cleared to blanks if  the
  1523.  string  is  not  found.   The  search beings at the character within the
  1524.  field that is specified by the initial value of the displacement.
  1525. 0
  1526.  ________________________________________________________________________
  1527.  
  1528.                                    -24-
  1529. 1
  1530.                                   BESTOP
  1531.  ________________________________________________________________________
  1532.  
  1533.  
  1534.         Example
  1535.  
  1536.         Find  the  displacement  of  the  character string
  1537.         "#7609" within the field 1.20.80  and  record  the
  1538.         displacement in  S.1.4.
  1539.  
  1540.                   F  '#7609'  1.20.80  D  S.1.4
  1541.  
  1542.  
  1543.         Notes
  1544.  
  1545.         1.  The search beings at the first position of the
  1546.         second   field   if   the  initial  value  of  the
  1547.         displacement is blank or zero.
  1548.  
  1549.         2.  The search ends when the number of  characters
  1550.         remaining  in  the  second  field is less than the
  1551.         number of characters in the first field.
  1552.  
  1553.         3.  The resulting displacement  is  always  stored
  1554.         without   leading   zeros   except   that  a  zero
  1555.         displacement  is  stored  as  a  single  zero.   A
  1556.         resulting  displacement  that  is  blank indicates
  1557.         that he string was not found.
  1558.  
  1559.         4.   The  leftmost   digits   of   the   resulting
  1560.         displacement  are  truncated  if  there  are  more
  1561.         characters in the displacement value than  in  the
  1562.         displacement field.
  1563.  
  1564.         5.   The displacement field may not be more than 4
  1565.         characters wide.
  1566.  
  1567.  
  1568.  
  1569.  2.__MOVE_(to_displaced_field)
  1570. +__  ____ ___ _________ ______
  1571.  
  1572.  ------------------------------------------------------------------------
  1573.                     M  (field)  field  D  field
  1574.                        (const)
  1575.  ------------------------------------------------------------------------
  1576.  
  1577.  
  1578.       The  contents  of  the  first  field  or  constant are moved to the
  1579.  locations in the second field that are specified by the displacement  in
  1580.  the  third  field.   The entire contents of the first field are moved if
  1581.  the number of positions between the displaced  location  in  the  second
  1582.  field  and  the  end of the second field is greater than or equal to the
  1583.  length of the first field.  Unfilled positions in he second field retain
  1584.  their original values.  The right most positions of the  field  are  not
  1585. 0
  1586.  ________________________________________________________________________
  1587.  
  1588.                                    -25-
  1589. 1
  1590.                                   BESTOP
  1591.  ________________________________________________________________________
  1592.  
  1593.  
  1594.  moved  if  their is insufficient space in the displaced locations in the
  1595.  second field.  The operation  is  not  executed  if  the  value  of  the
  1596.  displacement is greater than or equal to the width of the second field.
  1597.  
  1598.         Example
  1599.  
  1600.         Given  the  specified  contents  of  the following
  1601.         fields:
  1602.  
  1603.                   2.40.45      "A3    "
  1604.  
  1605.                   S.1.2        " 2"
  1606.  
  1607.         The instruction
  1608.  
  1609.                   M  ';'  1.40.45  D  S.1.2
  1610.  
  1611.         changes the contents of 2.40.45 to
  1612.  
  1613.                   "A3;   "
  1614.  
  1615.  
  1616.  
  1617.         Notes
  1618.  
  1619.         1.   The displacement field may not be more than 4
  1620.         characters wide.
  1621.  
  1622.         2.  The MOVE operation  is  not  executed  if  the
  1623.         displacement     field     contains    non-numeric
  1624.         characters.
  1625.  
  1626.  
  1627.  
  1628.  3.__MOVE_(from_displaced_field)
  1629. +__  ____ _____ _________ ______
  1630.  
  1631.  ------------------------------------------------------------------------
  1632.                      M  field  D field  field
  1633.  ------------------------------------------------------------------------
  1634.  
  1635.       The  third  field  is  filled  with characters from the first field
  1636.  starting with the character in the first field that is specified by  the
  1637.  displacement  in the second field.  The third field is filled completely
  1638.  unless there is an insufficient number of characters  in  the  displaced
  1639.  portion  of  the  first  field.   Unfilled  positions in the third field
  1640.  retain their original values.
  1641.  
  1642.         Example
  1643.  
  1644.         Given  the  specified  contents  of  the following
  1645.         fields:
  1646.  
  1647.  ________________________________________________________________________
  1648.  
  1649.                                    -26-
  1650. 1
  1651.                                   BESTOP
  1652.  ________________________________________________________________________
  1653.  
  1654.  
  1655.                   1.8.14        "ABCDEFG"
  1656.  
  1657.                   S.6.8         "  2"
  1658.  
  1659.                   2.4.7         "HIJK"
  1660.  
  1661.  
  1662.         The instruction
  1663.  
  1664.                   M  1.8.14  D  S.6.8  2.4.7
  1665.  
  1666.         changes the contents of 2.4.7 to:
  1667.  
  1668.                   "CDEF"
  1669.  
  1670.         Notes
  1671.  
  1672.         1.   The displacement field may not be more than 4
  1673.         characters wide.
  1674.  
  1675.         2.  The MOVE operation is not  executed  if  there
  1676.         are  non-numeric  characters  in  the displacement
  1677.         field.
  1678.  
  1679.  
  1680.  
  1681.  4.__DO_AGAIN
  1682. +__  __ _____
  1683.  
  1684.  ------------------------------------------------------------------------
  1685.                                D
  1686.  ------------------------------------------------------------------------
  1687.  
  1688.  
  1689.       This instruction causes the IF instructions at the beginning of the
  1690.  routine  containing  the  DO  AGAIN  instruction  to  be  retested.  The
  1691.  instruction should always be the last instruction in a routine as is  it
  1692.  will  prevent  any  remaining  instructions  in  the  routine from being
  1693.  executed.  The IF condition at the start of the routine must be designed
  1694.  to terminate the looping effect of the DO AGAIN  instruction  after  the
  1695.  desired  number of iterations.  To avoid indefinite looping, the program
  1696.  will terminate abnormally (condition code 16) if any combination  of  DO
  1697.  AGAIN instructions is executed 1000 times without reading a record.
  1698.  
  1699.         Example
  1700.  
  1701.         Branch to subroutine A seven times.
  1702.  
  1703.  
  1704.                   C S.8 '0'
  1705.                   I S.8 L '7'
  1706. 0
  1707.  ________________________________________________________________________
  1708.  
  1709.                                    -27-
  1710. 1
  1711.                                   BESTOP
  1712.  ________________________________________________________________________
  1713.  
  1714.  
  1715.                   B A
  1716.                   +'1'S.8
  1717.                   D
  1718.  
  1719.  
  1720.         Notes
  1721.  
  1722.         The DO AGAIN may also be used in a routine started
  1723.         by  an UNCONDITIONAL instruction when that routine
  1724.         calls  a   subroutine   which   executes   a   GET
  1725.         instruction  as a means of terminating the looping
  1726.         effect.
  1727.  
  1728.  
  1729.  
  1730. -
  1731. -
  1732. -
  1733. -
  1734. -
  1735. -
  1736. -
  1737. -
  1738. -
  1739. -
  1740. -
  1741. -
  1742.  
  1743.  ________________________________________________________________________
  1744.  
  1745.                                    -28-
  1746. 1
  1747.                                   BESTOP
  1748.  ________________________________________________________________________
  1749.  
  1750.  
  1751.                        IV.__PROGRAMMING_TECHNIQUES
  1752. +                      ___  ___________ __________
  1753. 0
  1754.  
  1755.       A.__Routines
  1756. +     __  ________
  1757.       Within  a  routine, instructions are arranged in the order in which
  1758.  they are to be executed.  Most routines begin with a set of  conditional
  1759.  instructions  that  establish  conditions  which  must be met before the
  1760.  processing instructions  of  the  routine  will  be  executed.   If  the
  1761.  conditions  are  not  met,  the  routine  is skipped until the next pass
  1762.  through the object program.  When present, conditional instructions (IF,
  1763.  OTHERWISE,  UNCONDITIONAL)  must  always  come  before  the   processing
  1764.  instructions in a routine.
  1765.  
  1766.         Example: Routines
  1767.  
  1768.  
  1769.         File  1  contains  records  that are 25 characters
  1770.         long with the following code position 14:
  1771.  
  1772.                        1 - MALE
  1773.                        2 - FEMALE
  1774.                        3 - DATA ERROR
  1775.  
  1776.         Recode  female records with the code "4" and write
  1777.         the recoded file as File 2.    Print  any  records
  1778.         with  invalid   codes.   Only  records  with valid
  1779.         codes should be written on file 2.
  1780.  
  1781.  
  1782.       The  resulting  program  contains four routines and is shown below.
  1783.  The instructions have been  numbered  for  identification  and  sequence
  1784.  purposes.   Instruction  numbers  may  precede the operation code of any
  1785.  instruction.  They are not  checked  by  the  BESTOP  Compiler  and  are
  1786.  ignored during the compilation process.  For purposed of discussion, the
  1787.  routines  in  each  example  are  identified  by the number of the first
  1788.  instruction in the routine.
  1789.  
  1790.  
  1791.                        1  M 1.1.25 2.1.25
  1792.                        2  I 1.14 E '2'
  1793.                        4  M '4' 2.14
  1794.                        5  I 2.14 U '1' A
  1795.                        6  I 2.14 U '4'
  1796.                        7  M 2.1.25 L.1.25
  1797.                        8  W L 1
  1798.                        9  O
  1799.                       10  W 2
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  ________________________________________________________________________
  1805.  
  1806.                                    -29-
  1807. 1
  1808.                                   BESTOP
  1809.  ________________________________________________________________________
  1810.  
  1811.  
  1812.         Routine
  1813.  
  1814.         1  Unconditionally  moves a copy of each record to
  1815.         the File 2 areas.  The first routine in a  program
  1816.         is  always  executed  unconditionally when no "IF"
  1817.         instructions are included in the routine.
  1818.  
  1819.         2 Tests position 14 of each input record  for code
  1820.         "2"  and  assigns the new code "4" to records that
  1821.         meet that test.
  1822.  
  1823.         5 Prints those records that have a  code  that  is
  1824.         unequal   to   both   "1"   and "4." The lines are
  1825.         single spaced.
  1826.  
  1827.         9 Writes all  of  the  records  that  have   valid
  1828.         codes,  i.e., all those that were not processed by
  1829.         routine 5.
  1830.  
  1831.       Any of the following instructions will start a routine:
  1832.  
  1833.              1.    A   conditional   instructions  following  a
  1834.              processing instruction.
  1835.  
  1836.              2.   The  first  instruction  in  a   program   or
  1837.              subroutine.
  1838.  
  1839.              3.   The  first instruction following a subroutine
  1840.              or table.
  1841.  
  1842.       A routine ends with the last instruction prior to:
  1843.  
  1844.              1.  The next routine
  1845.  
  1846.              2.  A table or subroutine.
  1847.  
  1848.              3.  The end of the program.
  1849.  
  1850.  
  1851.  
  1852.       B.__Subroutines
  1853. +     __  ___________
  1854.  
  1855.       Subroutines  start  with  a  SUBROUTINE  instruction and end with a
  1856.  RETURN instruction.  All of the routines between these two  instructions
  1857.  are  included in the subroutine.  A subroutine may not be started within
  1858.  another subroutine,  i.e.,  a  SUBROUTINE  instruction  may  not  appear
  1859.  between  the  SUBROUTINE  instruction  of  another  subroutine  and  its
  1860.  terminating RETURN instruction.
  1861.  
  1862. -
  1863.  ________________________________________________________________________
  1864.  
  1865.                                    -30-
  1866. 1
  1867.                                   BESTOP
  1868.  ________________________________________________________________________
  1869.  
  1870.  
  1871.       Subroutines may be placed anywhere in a program since they are  not
  1872.  executed  when  they are encountered; they are executed only by a BRANCH
  1873.  to the subroutine.  Control returns to  the  instruction  following  the
  1874.  BRANCH after the subroutine has been executed.
  1875.  
  1876.  
  1877.         Example: Subroutines
  1878.  
  1879.         File  2  contains  records  that are 60 characters
  1880.         long with the following code fields:
  1881.  
  1882.         Location Contents
  1883.  
  1884.            1-5 Individual identification number
  1885.  
  1886.            16 Race 1 - white 2 - negro 3 - other non-white
  1887.  
  1888.            34 Sex 1 - male 2 - female
  1889.  
  1890.         Screen the file for valid sex and race  codes  and
  1891.         print the following line for each invalid code:
  1892.  
  1893.         Location Contents
  1894.  
  1895.            1-5 Individual identification number
  1896.  
  1897.            7 Race
  1898.  
  1899.            9 Sex
  1900.  
  1901.            11-27  Error  message "INVALID RACE CODE" "INVALID
  1902.            SEX CODE"
  1903.  
  1904.  
  1905.       The  resulting  program  contains  three  routines, one of which is
  1906.  enclosed in a subroutine.
  1907.  
  1908.  
  1909.                        1    I 2.16 L '1' 0
  1910.                        2    I 2.16 G '3'
  1911.                        3    M 'INVALID RACE CODE' L.11.27
  1912.                        4    B 1
  1913.                        5    I 2.34 U '1' A
  1914.                        6    I 2.34 U '2'
  1915.                        7    M 'INVALID SEX CODE' L. 11.26
  1916.                        8    B 1
  1917.                        9    S 1
  1918.                       10    M 2.1.5 L.1.5
  1919.                       11    M 2.16 L.7
  1920.                       12    M 2.34 L.9
  1921. 0
  1922.  ________________________________________________________________________
  1923.  
  1924.                                    -31-
  1925. 1
  1926.                                   BESTOP
  1927.  ________________________________________________________________________
  1928.  
  1929.  
  1930.                       13    W L 1
  1931.                       14    R
  1932.  
  1933.  
  1934.         Routine
  1935.  
  1936.         1    Moves  the message "INVALID RACE CODE" to the
  1937.         listing area if  the  race  code  is  under  1  or
  1938.         greater  than  3.   Branches  to  Subroutine  1 to
  1939.         complete the printing of the error message.
  1940.  
  1941.         5 Moves the message  "INVALID  SEX  CODE"  to  the
  1942.         listing  area if the sex code is unequal to both 1
  1943.         and 2.  Branches to Subroutine 1 to  complete  the
  1944.         printing of the error message.
  1945.  
  1946.         9  The  start  of a subroutine which ends with the
  1947.         RETURN  instruction  number  14.   The  subroutine
  1948.         includes  only  one  routine but could contain any
  1949.         number that might be required.
  1950.  
  1951.         10 A routine which completes and prints a standard
  1952.         error message.   While  the  routine  is  executed
  1953.         unconditionally, it is only executed when a branch
  1954.         is made to subroutine 1.
  1955.  
  1956.  
  1957.  
  1958.       C.__Tables
  1959. +     __  ______
  1960.  
  1961.       A  table  consists  of  a TABLE instruction followed by one or more
  1962.  ENTRIES.  The TABLE INSTRUCTION identifies the table name and  specifies
  1963.  the  field  containing  the argument to be used in lookup operations and
  1964.  the field that is to contain the result of the lookup.   Each  entry  in
  1965.  the  table  is a single constant which includes an argument and a result
  1966.  in that order.  A table ends with the last entry prior to an instruction
  1967.  that is not an entry or with the end of  the  program,  whichever  comes
  1968.  first.   Tables  are  used only by lookup instructions and may be placed
  1969.  anywhere in a program.
  1970.  
  1971.         Example: Table Lookup
  1972.  
  1973.         File   1   contains   35   character   records  on
  1974.         individuals  with  the  age  of   the   individual
  1975.         recorded  with  leading  zeros in positions 12-13.
  1976.         The age of the individual must  be  coded  in  the
  1977.         manner  shown  below  and  the  age code should be
  1978.         added to the end of each record to produce  a  new
  1979.         record which should be written on File 2.
  1980.  
  1981. 0
  1982.  ________________________________________________________________________
  1983.  
  1984.                                    -32-
  1985. 1
  1986.                                   BESTOP
  1987.  ________________________________________________________________________
  1988.  
  1989.  
  1990.                        CODE      AGE
  1991.  
  1992.                         1        UNDER 14
  1993.                         2        14-19
  1994.                         3        20-24
  1995.                         4        25-34
  1996.                         5        35-44
  1997.                         6        45-54
  1998.                         7        55-64
  1999.                         8        65 AND OVER
  2000.  
  2001.  
  2002.  
  2003.       The program consists of a single routine and table.
  2004.  
  2005.  
  2006.  
  2007.                        1    M 1.1.35 2.1.35
  2008.                        2    L 1 H
  2009.                        3    W 2
  2010.                        4    T 1 1.12.13 2.36
  2011.                        5    '131'
  2012.                        6    '192'
  2013.                        7    '243'
  2014.                        8    '344'
  2015.                        9    '445'
  2016.                       10    '546'
  2017.                       11    '647'
  2018.                       12    '998'
  2019.  
  2020.  
  2021.         Routine
  2022.  
  2023.  
  2024.         1  Moves  the  input  record  to  the output area,
  2025.         performs a table lookup to get  the  required  age
  2026.         code and writes the coded record onto File 2.  The
  2027.         "lookup   high   or  equal"  form  of  the  lookup
  2028.         instruction has been used  to  stratify  the  data
  2029.         into  age  classes  corresponding to the resulting
  2030.         codes.
  2031.  
  2032.         4 A table whose entries extend through instruction
  2033.         number 12.  When a lookup operation  is  executed,
  2034.         the  program  argument  will  be  taken from field
  2035.         1.12.13 and the result will  be  placed  in  field
  2036.         2.36.
  2037.  
  2038. -
  2039.  
  2040.  ________________________________________________________________________
  2041.  
  2042.                                    -33-
  2043. 1
  2044.                                   BESTOP
  2045.  ________________________________________________________________________
  2046.  
  2047.  
  2048.       D.__Matched_Input_Files
  2049. +     __  _______ _____ _____
  2050.  
  2051.       A program may read and match two input files as long as both are in
  2052.  the  same  sequence  on  a  similar  set  of  key  fields.   One file is
  2053.  arbitrarily designated as the "A" file, and the other is  then  the  "B"
  2054.  file.   A  special  form of the IF instruction permits program tests for
  2055.  matching records or for unmatched records in either file.   A  run  type
  2056.  code  must  also  be  specified  to indicate whether more than on B file
  2057.  records may match a single A file record.
  2058.  
  2059.       The sequence keys for the two  files  are  specified  in  the  KEYS
  2060.  instruction.   The  designation  of  the  A file, B file and run type is
  2061.  handled through the execute parameter in the job control language.
  2062.  
  2063.         Example: Matched File Operations
  2064.  
  2065.         Match  a  set  of correction cards against the 120
  2066.         character master file records in file 1 using  the
  2067.         state  and  industry codes in the two files as the
  2068.         basis for the match.  If there is a match, replace
  2069.         the income data in file 1  with  the  income  data
  2070.         from   the   transaction   cards.   If  there  are
  2071.         unmatched correction cards,  print  the  card  and
  2072.         construct  a new record containing only the state,
  2073.         industry,  and  income  fields.    The   remaining
  2074.         records  from  file  1  should  be copied onto the
  2075.         updated file.  Both files are in  order  by  state
  2076.         and industry.
  2077.  
  2078.  
  2079.                   File 1 format (required fields only)
  2080.  
  2081.                     Location        Contents
  2082.  
  2083.                        2-3          State code
  2084.  
  2085.                       26-29         Industry code
  2086.  
  2087.                       41-48         Income
  2088.  
  2089.  
  2090.                   Card format
  2091.  
  2092.                     Location        Contents
  2093.  
  2094.                        1-2          State code
  2095.  
  2096.                        3-6          Industry code
  2097.  
  2098.                        7-14         Income
  2099.  
  2100.  
  2101.  ________________________________________________________________________
  2102.  
  2103.                                    -34-
  2104. 1
  2105.                                   BESTOP
  2106.  ________________________________________________________________________
  2107.  
  2108.  
  2109.       The  run  type  (1)  and  the  A  (File 1) and B (Reader) files are
  2110.  specified in the job control language.  The  first  instruction  in  the
  2111.  program specifies the location of the keys to be used in the match.  The
  2112.  remaining  instructions are grouped into four routines to handle each of
  2113.  the possible match or mismatch situations and to write the output file.
  2114.  
  2115.                        1  K 1.2.3 R.1.2 1.26.29 R.3.6
  2116.                        2  I M
  2117.                        3  M 1.1.120 2.1.120
  2118.                        4  M R.7.14 2.41.48
  2119.                        5  I B
  2120.                        6  M R.1.14 L.1.14
  2121.                        7  W L 1
  2122.                        8  M R.1.2 2.2.3
  2123.                        9  M R.3.6 2.26.29
  2124.                       10  M R.7.14 2.41.48
  2125.                       11  I A
  2126.                       12  M 1.1.120 2.1.120
  2127.                       13  U
  2128.                       14  W 2
  2129.  
  2130.         Routine
  2131.  
  2132.         2  Replaces  the income field in the income record
  2133.         with the income field from the matching correction
  2134.         card.
  2135.  
  2136.         5  Prints  the  unmatched  correction   card   and
  2137.         constructs  a  new  output record containing the
  2138.         state, industry and income fields.
  2139.  
  2140.         11 Moves records that are not to be  corrected  to
  2141.         the output file.
  2142.  
  2143.         13  Writes  an  output  record,  regardless of its
  2144.         source.
  2145.  
  2146.  
  2147. -
  2148. -
  2149. -
  2150. -
  2151. 0
  2152.  ________________________________________________________________________
  2153.  
  2154.                                    -35-
  2155. 1
  2156.                                   BESTOP
  2157.  ________________________________________________________________________
  2158.  
  2159.  
  2160.       E.__Page_Format_Control
  2161. +     __  ____ ______ _______
  2162.       A  two  character  zero  filled line counter provides the essential
  2163.  element of control in the printing of page headings, the skipping of the
  2164.  printer to a specific line or to the next page,  and  the  execution  of
  2165.  similar  functions  that  affect  the page layout of a report.  The line
  2166.  counter records the position of the next line to be printed on  a  page.
  2167.  It  is  set  to  "01"  when the printer is at the top of the page and is
  2168.  incremented an appropriate amount with each WRITE  instruction  that  is
  2169.  directed  to the printer.  It is reset to "01" with a skip to the top of
  2170.  a new page.  The counter may be tested with the "printer line test" form
  2171.  of the IF instruction.
  2172.  
  2173.         Example: Page Format Control
  2174.  
  2175.         Print  the  fields  specified  in  the line format
  2176.         below from each  record  in  File  1.   Print  the
  2177.         report title "Average Income Report" at the top of
  2178.         each  page  along  with  a  page  number and date.
  2179.         Print appropriate headings  over  the  columns  of
  2180.         data.   Do  not print beyond the 54th line of each
  2181.         page.
  2182.  
  2183.  
  2184.                File 1 Format (required fields only)
  2185.  
  2186.                       Location       Contents
  2187.  
  2188.                          8           Region
  2189.  
  2190.                       14-15          Age
  2191.  
  2192.                         18           Race
  2193.  
  2194.                         22           Sex
  2195.  
  2196.                       31-36          Average Income (unedited)
  2197.  
  2198.  
  2199.                      Location        Contents
  2200.  
  2201.                          4           Region
  2202.  
  2203.                      11-12           Age
  2204.  
  2205.                         19           Race
  2206.  
  2207.                         26           Sex
  2208.  
  2209.                      33-39           Average Income (edited XXX,XXX)
  2210. -
  2211.  ________________________________________________________________________
  2212.  
  2213.                                    -36-
  2214. 1
  2215.                                   BESTOP
  2216.  ________________________________________________________________________
  2217.  
  2218.  
  2219.       The program consists of three routines as follows:
  2220.  
  2221.           1    I C G '54'
  2222.           2    W S H
  2223.           3    I C E '01'
  2224.           4    M 'AVERAGE INCOME REPORT' L.1.21
  2225.           5    M 'PAGE' L.32.35
  2226.           6    + '1' S.1.3               * PAGE COUNTER
  2227.           7    M S.1.3 L.37.39
  2228.           8    W L 1
  2229.           9    M D.1.18 L.1.18           * DATE
  2230.           10   W L 2
  2231.           11   M 'AVERAGE' L.34.40
  2232.           12   W L 1
  2233.           13   M 'REGION   AGE   RACE' L.1.20
  2234.           14   M 'SEX    INCOME' L.25.39
  2235.           15   W L 2
  2236.           16   U
  2237.           17   M 1.8 L.4                 * REGION
  2238.           18   M 1.14.15 L.11.12         * AGE
  2239.           19   M 1.18 L.19               * RACE
  2240.           20   M 1.22 L.26               * SEX
  2241.           21   E 1.31.36 L.33.39 '   ,   '
  2242.           22   W L 1
  2243.  
  2244.  
  2245.         Routine
  2246.  
  2247.         1  Tests for the end of a page (line counter value
  2248.         greater than 54) and skips to the  top  of  a  new
  2249.         page if the test is met.  The line counter is then
  2250.         reset to '01'.
  2251.  
  2252.         3  Prints  headings  at  the top of the page (line
  2253.         counter equal to '01'); numbers  and  dates  (from
  2254.         the  date area) each page.  It is good practice to
  2255.         place the heading routine  immediately  after  the
  2256.         end  of  page  routine.   If  the order of the two
  2257.         routines had been  reversed,  headings  would  not
  2258.         have  been  printed after the first page.  The end
  2259.         of page routine would have caused the line counter
  2260.         to be reset to "01", but the data printing routine
  2261.         below would have incremented the counter  to  "02"
  2262.         with  the  printing  of  a  data  line  before the
  2263.         heading routine was encountered.
  2264.  
  2265.         Care  must  be  taken  with  the  spacing  of  the
  2266.         constants  that make up the titles in the heading.
  2267.         It is good practice to layout the necessary titles
  2268.         on a printer spacing work sheet prior to coding  a
  2269.         heading routine.
  2270.  
  2271.  ________________________________________________________________________
  2272.  
  2273.                                    -37-
  2274. 1
  2275.                                   BESTOP
  2276.  ________________________________________________________________________
  2277.  
  2278.  
  2279.         16 Unconditionally print  the required fields from
  2280.         each record.  The average earnings field is edited
  2281.         to insert a comma after the thousands digit and to
  2282.         suppress leading zeros.
  2283.  
  2284.  
  2285.  
  2286.       F.__Summarizing_Data
  2287. +     __  ___________ ____
  2288.  
  2289.       Data  in separate records may be summarized to provide group totals
  2290.  as long as the input file is sorted on the code field(s) that define the
  2291.  groups.  A file may be sorted with a standard utility  routine  that  is
  2292.  provided  with the operating system.  The "control break" form of the IF
  2293.  instruction is used to test for the change of a group in  routines  that
  2294.  process group totals.
  2295.  
  2296.         Example: Summarizing Data
  2297.  
  2298.         In   a  file  of   health   insurance   data,  the
  2299.         records are identified by state, program, and type
  2300.         of   service   with   one    record    for    each
  2301.         combination of those characteristics.  Each record
  2302.         also  contains  the  amount in dollars expended in
  2303.         the specified State on the  program  and  type  of
  2304.         service  in  a calendar year.  National totals are
  2305.         required for all expenditures, for  each  program,
  2306.         and for each type of service within a program.
  2307.  
  2308.         The  file  must first be sorted by program by type
  2309.         of service so that all of the records for a single
  2310.         program will  be  grouped  together  in  ascending
  2311.         sequence  by  program code and within those groups
  2312.         in ascending sequence by type of service.  In this
  2313.         sort the program code field is  called  the  major
  2314.         key  and  the  type  of  service code field is the
  2315.         minor key.  The first few records  in  the  sorted
  2316.         file might contain the following codes and data in
  2317.         the  order  shown.  The records have been numbered
  2318.         for reference
  2319.  
  2320.  
  2321.  
  2322.                           RECORD CONTENTS
  2323.  
  2324.         Record                        Type of
  2325.         Number         Program        Service        Expenditures
  2326.  
  2327.           1              01             3              284921
  2328.           2              01             3               17634
  2329.           3              01             3               43172
  2330. 0
  2331.  ________________________________________________________________________
  2332.  
  2333.                                    -38-
  2334. 1
  2335.                                   BESTOP
  2336.  ________________________________________________________________________
  2337.  
  2338.  
  2339.           4              01             5                9519
  2340.           5              01             5               38178
  2341.           6              01             7                8027
  2342.           7              01             7               23213
  2343.           8              02             2                6521
  2344.           9              02             3               18276
  2345.          10              03             3               50332
  2346.          11              03             3                9235
  2347.          12              03             3               45378
  2348.          13              03             5               87389
  2349.          14              03             5               20426
  2350.          15              03             7               72464
  2351.          16              03             7               15400
  2352.          17              04             2               57441
  2353.  
  2354.       The data records have the following format:
  2355.  
  2356.  
  2357.               Position            Contents
  2358.  
  2359.                 1-2               Program code
  2360.  
  2361.                 3-4               State code
  2362.  
  2363.                 5                 Type of Service
  2364.  
  2365.                 6-12              Expenditure in dollars
  2366.  
  2367.  
  2368.  
  2369.         The resulting program contains six routines, three
  2370.         to  print various levels of totals, an end of page
  2371.         routine, a heading routine, and routine which adds
  2372.         the expenditure data into counters.  Counters have
  2373.         been set up in scratchpad fields S.1.7, S.8.14 and
  2374.         S.15.24 for the service, program and grand  totals
  2375.         respectively.   Routines  to  print  totals appear
  2376.         first  in  the  program  so  that  totals  for   a
  2377.         completed   group   will  be  printed  before  the
  2378.         expenditures shown in the first record  of  a  new
  2379.         group  are  added  into the counters and so that a
  2380.         page will not start with a program or grand total.
  2381.         "Control break" IF instructions are used to detect
  2382.         changes in the program and type of  service  codes
  2383.         that  signal  the end of a group.  An "end of run"
  2384.         IF instruction controls the printing of the  grand
  2385.         total.   Routines  that  depend on "control break"
  2386.         and "end of run" IF instructions are the only ones
  2387.         that can be executed during the  "last  pass:   so
  2388.         that  totals  covering  routines  are  arranged in
  2389. 0
  2390.  ________________________________________________________________________
  2391.  
  2392.                                    -39-
  2393. 1
  2394.                                   BESTOP
  2395.  ________________________________________________________________________
  2396.  
  2397.  
  2398.         minor to major order so  that  subtotals  will  be
  2399.         printed before higher level totals.
  2400.  
  2401.           1    I 1.1.2 0                  * PROGRAM BREAK
  2402.           2    I 1.5                      * ST OR PGM BRK
  2403.           3    E S.1.7 L.21.29            * TYTPE TOTAL
  2404.           4    W L 1
  2405.           5    C S.1.7                    * CLEAR COUNTER
  2406.           6    M 1.5 L.14
  2407.           7    I 1.1.2                    * PROGRAM BRK
  2408.           8    M 'TOTAL' L.12.16
  2409.           9    E S.8.14 L.21.29           * PROGRAM TOTAL
  2410.          10    W L 2
  2411.          11    C S.8.14                   * CLR PGM TOTAL
  2412.          12    M 1.1.2 L.4.5
  2413.          13    M 1.5 L.14
  2414.          14    I F                        * US TOTAL
  2415.          15    M 'ALL PROGRAMS' L.5.16
  2416.          16    E S.15.23 L.19.29
  2417.          17    W L 1
  2418.          18    I C G '54'
  2419.          19    W S H
  2420.          20    I C E '01'
  2421.          21    M 'PROGRAM   SERVICE    AMOUNT' L.2.29
  2422.          22    W L 2
  2423.          23    M 1.1.2 L.4.5
  2424.          24    M 1.5 L.14
  2425.          25    U
  2426.          26    + 1.6.12 S.1.7             * TYPE TOTAL
  2427.          27    + 1.6.12 S.8.14            * PROGRAM TOTAL
  2428.          28    + 1.6.12 S.15.23           * US TOTAL
  2429.  
  2430.  
  2431.         Routine
  2432.  
  2433.         1 Prints type of service totals with a  change  in
  2434.         either  the  program or type of service code.  The
  2435.         test for a change in program code was included  to
  2436.         avoid  problems with situations such as that which
  2437.         arises between records 10 and 11 when a change  in
  2438.         program  code  was  not accompanied by a change in
  2439.         the type of service code.   The  type  of  service
  2440.         code  for  the next group is stored in the listing
  2441.         areas after the total for the last  service  group
  2442.         has  been  printed.   The service total counter is
  2443.         cleared for the next service group total.
  2444.  
  2445.         7 Prints program  totals  with  a  change  in  the
  2446.         program  code.   Both  the  program  code  and the
  2447.         service code are stored in the listing area  after
  2448. 0
  2449.  ________________________________________________________________________
  2450.  
  2451.                                    -40-
  2452. 1
  2453.                                   BESTOP
  2454.  ________________________________________________________________________
  2455.  
  2456.  
  2457.         printing  since the service code stored by routine
  2458.         #1 was wiped cut by the word  "TOTAL."  Note  that
  2459.         the  program  code  is  only stored (and therefore
  2460.         printed) with a change in  program.   Such  "group
  2461.         indicating"   improves   the  readability  of  the
  2462.         resulting listing.
  2463.  
  2464.         14 Prints the grand total at the end of  the  run.
  2465.         There  is no need to clear the grand total counter
  2466.         as it will not be used again.
  2467.  
  2468.         18 Skips to the top of  the  next  page  when  the
  2469.         printer goes beyond line 54.
  2470.  
  2471.         20  Prints column headings at the top of the page.
  2472.         The program and service codes are  stored  in  the
  2473.         listing   area   to   provide   for   the   proper
  2474.         identification of the first  date  line  following
  2475.         the headings.
  2476.  
  2477.         25  Adds  the  expenditure amount from each record
  2478.         (unconditionally) into the service,  program,  and
  2479.         grand total counters.
  2480.  
  2481.         Note  the  comments  throughout the program.  They
  2482.         make  the  program  more  readable  and   aid   in
  2483.         debugging.   Also,  should changes have to be made
  2484.         to the program, comments  tend  to  be  exceedinly
  2485.         helpful.
  2486.  
  2487.  
  2488.  
  2489. -
  2490. -
  2491. -
  2492. -
  2493. -
  2494. -
  2495. 0
  2496.  ________________________________________________________________________
  2497.  
  2498.                                    -41-
  2499. 1
  2500.                                   BESTOP
  2501.  ________________________________________________________________________
  2502.  
  2503.  
  2504.                           V.__PROGRAM_DEBUGGING
  2505. +                         __  _______ _________
  2506. 0
  2507.       A BESTOP run produces a number of items which are useful in program
  2508.  debugging  or  in  checking  the  results  of  the  run.   These include
  2509.  compilation diagnostics and end of run file dumps and record counts.  It
  2510.  is also possible to execute runs which produce only program diagnostics.
  2511.  
  2512.       A.__Compilation_Diagnostics
  2513. +     __  ___________ ___________
  2514.  
  2515.       Compilation diagnostic messages are produced during the compilation
  2516.  of  the  individual  instructions  and  at  the  end  of the compilation
  2517.  process.  The instruction diagnostics note such things  as  unrecognized
  2518.  instruction  patterns, invalid field specifications, incorrect sequences
  2519.  of instructions and overlapping fields.  They are printed to  the  right
  2520.  of  the  instruction  that  is in error.  End of compilation diagnostics
  2521.  note irregular conditions that might exist at the end of  a  compilation
  2522.  such  as  a  missing  KEYS  statement  in  a matched file run.  They are
  2523.  printed at the end of the instruction listing.
  2524.  
  2525.       Diagnostic errors  must  be  corrected  before  a  program  can  be
  2526.  executed.
  2527.  
  2528.       B.__Instruction_Diagnostics
  2529. +     __  ___________ ___________
  2530.  
  2531.       An  instruction  diagnostic  is  printed as a series of dots to the
  2532.  left of the  instruction  with  the  dots  representing  the  individual
  2533.  parameters of the instruction from left to right.  The dot corresponding
  2534.  to the parameter that is in error is replaced by a letter that indicates
  2535.  the nature of the error.  The meanings of the error letters are provided
  2536.  below.
  2537.  
  2538.          .F....  File  Code Error (may occur in the second through
  2539.          the sixth instruction parameters) The file  code  of  the
  2540.          specified  field  is  not  a  legal file code.  Check and
  2541.          recode the field specification.
  2542.  
  2543.          .I.... Write File Error - The file specified in  a  WRITE
  2544.          instruction  has  been  specified as an input file in the
  2545.          EXEC statement.  Check  the  program  logic  and  correct
  2546.          either the WRITE or the EXEC statement.
  2547.  
  2548.          .L....  Field  Length  Error  (may  occur  in  the second
  2549.          through the sixth instruction parameters) The  length  of
  2550.          the  specified  field  exceeds  the maximum permitted for
  2551.          that  type  of  instruction.   See   the   appendix   for
  2552.          instruction field length restrictions.
  2553.  
  2554.          .M....  Match  File  Code  Error (may occur in the second
  2555.          through the eleventh parameters) The  file  code  of  the
  2556. 0
  2557.  ________________________________________________________________________
  2558.  
  2559.                                    -42-
  2560. 1
  2561.                                   BESTOP
  2562.  ________________________________________________________________________
  2563.  
  2564.  
  2565.          field specification does not match the corresponding A or
  2566.          B file code specified in the job control language.
  2567.  
  2568.          .O....  Field  Overlap  Error  (may occur in two or three
  2569.          parameters within a  single  instruction)  The  specified
  2570.          fields overlap, i.e., they have one or more characters in
  2571.          common.   Overlapping  fields  are not permitted within a
  2572.          single instruction.  Recode the instruction to  eliminate
  2573.          the  overlap  or replace it with two or more instructions
  2574.          which  will  perform  the   desired   operation   without
  2575.          overlapping fields within a single instruction.
  2576.  
  2577.          .P... Instruction Pattern Error - There is no instruction
  2578.          in  the  BESTOP  language  with the particular pattern of
  2579.          operation  code,  constant,  field   specifications   and
  2580.          modifiers  as that specified.  Recheck the description of
  2581.          the desired instruction.
  2582.  
  2583.          .R... Field Range Error (may occur in the second  through
  2584.          the  sixth  instruction  parameters)  Part  or all of the
  2585.          specified field is beyond the limit of the records in the
  2586.          specified file.  For input files the limit is the  actual
  2587.          record  length  as  specified in the data set label.  For
  2588.          numbered output files the  limit  is  4096  bytes  unless
  2589.          record  lengths are provided in the DD statements for the
  2590.          output files.  Record length limits for the reader, punch
  2591.          and listing files are 80, 80 and 132  respectively.   The
  2592.          limit  for  the  date  area is 42 bytes.  In any event, a
  2593.          field
  2594.  
  2595.          .S...  Instruction Sequence Error - indicates a violation
  2596.          of one of the following sequence rules:
  2597.  
  2598.              1.   An  IF instruction with an and/or link can only
  2599.              be followed by an IF instruction.  Conversely, an IF
  2600.              instruction  cannot   immediately   follow   an   IF
  2601.              instruction that does not have an and/or link.
  2602.  
  2603.              2.  An UNCONDITIONAL instruction can only be used to
  2604.              start  a  routine that immediately follows a routine
  2605.              started by an IF or OTHERWISE Instruction.
  2606.  
  2607.              3.  An OTHERWISE instruction can  only  be  used  to
  2608.              start  a  routine that immediately follows a routine
  2609.              started by an IF instruction.
  2610.  
  2611.              4.  IF, OTHERWISE, or UNCONDITIONAL instructions may
  2612.              not immediately precede or follow each  other  since
  2613.              only one type of conditional instruction may be used
  2614.              to   start   a   routine.    However,   several   IF
  2615. 0
  2616.  ________________________________________________________________________
  2617.  
  2618.                                    -43-
  2619. 1
  2620.                                   BESTOP
  2621.  ________________________________________________________________________
  2622.  
  2623.  
  2624.              instructions may appear in succession when they  are
  2625.              properly linked.
  2626.  
  2627.              5.   A SUBROUTINE or TABLE may not be defined within
  2628.              a SUBROUTINE.  However, a SUBROUTINE may  contain  a
  2629.              BRANCH  to another subroutine as long as it does not
  2630.              result in a direct or indirect branch  back  to  the
  2631.              SUBROUTINE containing the BRANCH.
  2632.  
  2633.  
  2634.          T.....  Parameter Type Error (may occur in any parameter)
  2635.          - The specified parameter was  not  of  a  type  that  is
  2636.          recognized  by  the  BESTOP program.  The following types
  2637.          are permitted:
  2638.  
  2639.              1.    Operation   codes   and   modifiers  -  single
  2640.              characters
  2641.  
  2642.              2.   Constants  -  enclosed  in   apostrophes.    An
  2643.              apostrophe  within  a constant is represented by two
  2644.              successive apostrophes.
  2645.  
  2646.               3.  Field specifications of
  2647.              the form F.S.E or F.S where:
  2648.  
  2649.                   F  is a valid file code,
  2650.                   S  is one to four digits denoting the starting
  2651.                      position of the field, and
  2652.                   E  is one to four digits denoting the ending
  2653.                      position of the field.
  2654.  
  2655.         Parameters  must  be  separated from each other by
  2656.         one or more blanks.
  2657.  
  2658.  
  2659.       D.__Record_Counts_And_File_Dumps
  2660. +     __  ______ ______ ___ ____ _____
  2661.  
  2662.       Record counts for each file processed by the program are printed at
  2663.  the end of the run.  These counts should be checked for consistency with
  2664.  the anticipated results of the run.
  2665.  
  2666.       The program also prints a dump of the first fifty records that were
  2667.  processed  in the order in which they were read or written.  The records
  2668.  are printed 100 characters to the  line  and  are  identified  by  file.
  2669.  Record  lengths  and  consecutive  record  numbers are also shown on the
  2670.  listing.  These  dumps  should  be  reviewed  carefully  to  verify  the
  2671.  processing performed by the program.
  2672.  
  2673. -
  2674.  
  2675.  ________________________________________________________________________
  2676.  
  2677.                                    -44-
  2678. 1
  2679.                                   BESTOP
  2680.  ________________________________________________________________________
  2681.  
  2682.  
  2683.       E.__Test_Runs
  2684. +     __  ____ ____
  2685.  
  2686.       Test  runs  may be performed to obtain any diagnostic messages that
  2687.  might be produced by the compilation  of  a  program  or  to  check  the
  2688.  processing of a limited number of records from the input files(s).
  2689.  
  2690.       A program that contains diagnostic errors cannot be executed.  If a
  2691.  diagnostic error is encountered, the run is terminated at the end of the
  2692.  compilation  step.   It  is  frequently  advantageous  to submit a short
  2693.  production run without testing since the program will either be executed
  2694.  or Bestop will issue diagnostic messages indicating why the  run  cannot
  2695.  be executed.
  2696.  
  2697.       Occasionally,  it  is  useful  to  compile a program for diagnostic
  2698.  purposes without executing it even if there are  no  diagnostic  errors.
  2699.  It  is possible to do this by specifying a diagnostic run in the program
  2700.  parameters of the job control language.
  2701.  
  2702.       Short test runs can be executed on a portion of the  input  file(s)
  2703.  by  including  a  halt  procedure in the program.  This procedure should
  2704.  count the number of passes through the object program and halt  the  run
  2705.  when a sufficient number of records have been processed.  For example, a
  2706.  procedure  that  would limit the processing to 500 records from a single
  2707.  input file would be:
  2708.  
  2709.                          + '1' S.1.3
  2710.                          I N S.1.3 G '500'
  2711.                          H R
  2712.  
  2713.  
  2714.  
  2715. -
  2716. -
  2717. -
  2718. -
  2719. -
  2720. -
  2721. -
  2722.  ________________________________________________________________________
  2723.  
  2724.                                    -45-
  2725. 1
  2726.                                   BESTOP
  2727.  ________________________________________________________________________
  2728.  
  2729.  
  2730.              VI.__APPENDIX_A_-_OS/370_OPERATING_INSTRUCTIONS
  2731. +            ___  ________ _ _ ______ _________ ____________
  2732. 0
  2733.       A.__Job_Control_Language
  2734. +     __  ___ _______ ________
  2735.       Job  control  language  (JCL) provides information to the operating
  2736.  system on the files and other resources required for  a  job.   It  also
  2737.  identifies the user and provides necessary accounting information.
  2738.  
  2739.  
  2740.       B.__JOB_Statement
  2741. +     __  ___ _________
  2742.  
  2743.       The JOB statement identifies the user, specifies his account number
  2744.  and  establishes  the  work class of the job.  The parameters of the JOB
  2745.  card are covered in the User's Guide.
  2746.  
  2747.       C.__EXEC_Statement
  2748. +     __  ____ _________
  2749.  
  2750.       The  EXEC  statement  calls  the  BESTOP  compiler,  passes program
  2751.  parameters, specifies core memory requirements and sets a time limit for
  2752.  the run.  An EXEC statement is required for each BESTOP program that  is
  2753.  to be run within a job.  It is normally written in the following form:
  2754.  
  2755.  
  2756.  //step  EXEC  PGM=BESTOP,REGION=sizeK,PARM='parameters'
  2757.  
  2758.         where:
  2759.  
  2760.         step  -  is  the name of the step within the
  2761.         job.  It must begin with  a  letter  and  may  not
  2762.         exceed 8 characters.
  2763.  
  2764.         size  -  is the memory requirement in thousands of
  2765.         bytes.  This number must be followed by the letter
  2766.         "K." Bestop requires a minimum of 54K if  tape  or
  2767.         disk  files  are  not used.  Additional memory for
  2768.         tape and disk  files  is  equal  to  approximately
  2769.         twice  the  sum  of  the  tape  or disk file block
  2770.         sizes.  (See BLKSIZE in the DD statement.)
  2771.  
  2772.  
  2773.         parameters - are the program  parameters  required
  2774.         by the BESTOP compiler.  They must be separated by
  2775.         commas and enclosed in apostrophes.  The following
  2776.         parameters may be used:
  2777.              N           Suppresses the Bestop program listing
  2778.  
  2779.              I=(R/1-6)   Specifies the file code of the input file
  2780.                          in runs with a single input file.
  2781.  
  2782.              T=(1/2)     Specifies the run type in matched file
  2783.                          runs.
  2784.  
  2785.  ________________________________________________________________________
  2786.  
  2787.                                    -46-
  2788. 1
  2789.                                   BESTOP
  2790.  ________________________________________________________________________
  2791.  
  2792.  
  2793.              A=(R/1-6)   Specifies the A file in a matched file
  2794.                          run.
  2795.  
  2796.              B=(R/1-6)   Specifies the B file in a matched file
  2797.                          run.
  2798.  
  2799.              D           Specifies a diagnostic run.
  2800.  
  2801.              C=number    Specifies the number of records to
  2802.                          be dumped on DDN=FILEDUMP, the
  2803.                          default is fifty.
  2804.  
  2805.         Example: Exec Statement
  2806.  
  2807.  //STEP1  EXEC  PGM=BESTOP,REGION=420K,PARM='T=1,A=1,B=2'
  2808.  
  2809.  
  2810.       D.__STEPLIB_Card
  2811. +     __  _______ ____
  2812.  
  2813.       The  STEPLIB  card is required.  It identifies the library on which
  2814.  the BESTOP compiler is located.
  2815.  
  2816.  //STEPLIB DD DISP=SHR,DSN=FEA.LINKLIB
  2817.  
  2818.  
  2819.       E.__DD_Statements
  2820. +     __  __ __________
  2821.  
  2822.       The DD Statement is used to identify the files to be processed in a
  2823.  step,  to  designate  them  as  input or output files and to specify the
  2824.  disposition of the files at the end of the run.  They are also  used  to
  2825.  specify  the  logical  record  length  and  block size for output files.
  2826.  Consult the instalations User's Guide and various manuals for details.
  2827.  
  2828.  
  2829.         Example: Job Control Language
  2830.  
  2831.         To transfer a deck of cards to a temporary file on
  2832.         disk  that  is  to  be used in a later step in the
  2833.         job.
  2834.  
  2835.  
  2836.  //STEPA  EXEC  PGM=BESTOP,REGION=240K,PARM='I=R'
  2837.  //STEPLIB  DD  DISP=SHR,DSN=FEA.LINKLIB
  2838.  //FIELDUMP DD  SYSOUT=A
  2839.  //LISTING  DD  SYSOUT=A
  2840.  //FILE1    DD  UNIT=SYSDA,DISP=(NEW,PASS),SPACE=(CYL,(5,5)),
  2841.  //             DCB=(LRECL=80,BLKSIZE=6400),DSN=&&CARDS
  2842.  //PROGRAM   DD   *
  2843.  M R.1.80 1.1.80
  2844.  W 1
  2845.  //READER  DD   *
  2846.  
  2847.  ________________________________________________________________________
  2848.  
  2849.                                    -47-
  2850. 1
  2851.                                   BESTOP
  2852.  ________________________________________________________________________
  2853.  
  2854.  
  2855.          .
  2856.          .
  2857.          .
  2858.      data cards
  2859.          .
  2860.          .
  2861.          .
  2862.  
  2863.         To  read  and process a tape file to produce a new
  2864.         tape file.
  2865.  
  2866.  //PROCESS  EXEC   PGM=BESTOP,REGION=190K,PARM='I=1'
  2867.  //STEPLIB  DD  DISP=SHR,DSN=FEA.LINKLIB
  2868.  //FILEDUMP DD  SYSOUT=A
  2869.  //LISTING  DD  SYSOUT=A
  2870.  //FILE1    DD  DSN=CNaaaa.uuu.MY.DATA,DISP=OLD
  2871.  //FILE2    DD  DSN=CNaaaa.uuu.COPY.DATA,DISP=(,CATLG),
  2872.  //             DCB=(LRECL=80,BLKSIZE=6160,RECFM=FB),
  2873.  //             UNIT=DASD,SPACE=(TRK,(10,10),RLSE)
  2874.  //PROGRAM  DD     *
  2875.         .
  2876.         .
  2877.  program cards
  2878.         .
  2879.         .
  2880.  
  2881.  
  2882.       F.__Completion_Codes
  2883. +     __  __________ _____
  2884.  
  2885.       The following completion codes may be encountered in BESTOP runs.
  2886.  
  2887.  
  2888.  S000  Normal end of run
  2889.  
  2890.  S004  run ended by halt run instruction.
  2891.  
  2892.  S008  Diagnostic run
  2893.  
  2894.  S00C  Run ended by HALT JOB instruction
  2895.  
  2896.  S322  Execution of the job step took longer than the time
  2897.        allowed by the TIME parameter.
  2898.  
  2899.  S722  Maximum number of lines exceeded.
  2900.  
  2901.  S80A  The program required more memory than specified in the
  2902.        REGION parameter.
  2903.  
  2904.  S813  The dsname specified in a DD statement does not agree
  2905.        with the dsname in the file header label.
  2906. 0
  2907.  ________________________________________________________________________
  2908.  
  2909.                                    -48-
  2910. 1
  2911.                                   BESTOP
  2912.  ________________________________________________________________________
  2913.  
  2914.  
  2915.       G.__External_Tables
  2916. +     __  ________ ______
  2917.  
  2918.       Frequently  it  may  be  more convenient to code a Bestop table and
  2919.  save it into a dataset that may be referenced  by  the  Bestop  program.
  2920.  This  may  be  accomplished  by  coding the table entries (arguments and
  2921.  results) on a records and saving these records into a  card  image  file
  2922.  .The table is then referenced via a special DD statement identifying the
  2923.  external table.
  2924.  
  2925.  
  2926.         Example: External Table
  2927.  
  2928.  //STEP1  EXEC  PGM=BESTOP,REGION=240K,PARM='I=R'
  2929.  //STEPLIB  DD  DISP=SHR,DSN=FEA.LINKLIB
  2930.  //FIELDUMP DD  SYSOUT=A
  2931.  //LISTING  DD  SYSOUT=A
  2932.  //TABLEQ   DD  DISP=OLD,DSN=CNaaaa.PRJ.BESTOP.TABLES(TABQ)
  2933.  //FILE1    DD  UNIT=SYSDA,DISP=(NEW,PASS),SPACE=(CYL,(5,5)),
  2934.  //             DCB=(LRECL=120,BLKSIZE=6000),DSN=&&CARDS
  2935.  //PROGRAM   DD   *
  2936.  ****** ADD COUNTY NAMES TO THE FILE *****
  2937.  M R.1.80 1.1.80
  2938.  L Q E
  2939.  W 1
  2940.  T Q  R.1.6  1.101.120  * COUNTY NAME LOOKUP
  2941.  $
  2942.  //READER  DD   *
  2943.          .
  2944.          .
  2945.          .
  2946.      data cards
  2947.          .
  2948.  
  2949.  
  2950.         Notes:
  2951.  
  2952.         The "TABLEQ" JCL statement establishes the linkage
  2953.         between   the   exteranl   table   and  the  table
  2954.         definition in the program.
  2955.  
  2956.         The record length of  the  external  must  be  80.
  2957.         Therefore  the  sum of the lengths of the argument
  2958.         and result cannot exceed 80.
  2959.  
  2960.         The  "$"  after  the  table  definition  statement
  2961.         indicates that this is a external table.
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  ________________________________________________________________________
  2969.  
  2970.                                    -49-
  2971. 1
  2972.                                   BESTOP
  2973.  ________________________________________________________________________
  2974.  
  2975.  
  2976.                   VII.__APPENDIX_B_-_MAXIMUM_FIELD_SIZES
  2977. +                 ____  ________ _ _ _______ _____ _____
  2978. 0
  2979.  
  2980.       The widths of the fields or constants in the following instructions
  2981.  are limited to the specified number of characters.
  2982.  
  2983.              IF (Character Field Comparison          256
  2984.              IF (Numeric Field Comparison             16
  2985.              IF (Control Break)                      256
  2986.              MOVE                                   4096
  2987.              EDIT                                     16
  2988.              CLEAR                                  4096
  2989.              ADD                                      16
  2990.              SUBTRACT                                 16
  2991.              MULTIPLY
  2992.                   Multiplicand                        16
  2993.                   Multiplier                          15
  2994.                   Product + Rounding                  16
  2995.              DIVIDE
  2996.                   Dividend                            16
  2997.                   Divisor                             15
  2998.                   Quotient (extended)                 14
  2999.              KEYS                                    256
  3000.  
  3001.  
  3002.  
  3003. -
  3004. -
  3005. -
  3006. -
  3007. -
  3008. -
  3009. -
  3010. -
  3011.  
  3012.  ________________________________________________________________________
  3013.  
  3014.                                    -50-
  3015. 1
  3016.                                   BESTOP
  3017.  ________________________________________________________________________
  3018.  
  3019.  
  3020.             VIII.__APPENDIX_C_-_EIA_IMPLEMENTATIONS_OF_BESTOP
  3021. +           _____  ________ _ _ ___ _______________ __ ______
  3022. 0
  3023.       A.__BESTOP50,_BESTOPVL,_BEST400
  3024. +     __  _________ _________ _______
  3025.  
  3026.       These  are  the  original  versions  of  BESTOP  avalibale  at EIA.
  3027.  Basically they are all the same.  In the BEST400 version, 400K  of  work
  3028.  area  is  allocated  in order that the user may write larger programs or
  3029.  tables.
  3030.  
  3031.       B.__SUPERB
  3032. +     __  ______
  3033.  
  3034.       SUPERB  is a enhanced version of BESTOP the allows the user to call
  3035.  this  program  from  a  higher  level  language  like  PL/1  or   Cobol.
  3036.  Furthermore,  only  columns 1 thur 72 of the source program are scanned,
  3037.  and columns 73 thru 80 are ignored.  This means the user may enter  "RUN
  3038.  FETCH" instead of "RUN FET UNN" in Superwylbur.  In addition, the source
  3039.  program  gets  listed in the SYSPRINT file rather than the LISTING file.
  3040.  Also file counts are displayed in the SYSPRINT file.
  3041.  
  3042.       C.__BESTOP
  3043. +     __  ______
  3044.  
  3045.       BESTOP  is  actually  a  PL/1 program that calls SUPERB.  It offers
  3046.  several interesting features.  The user may code  instructions  to  copy
  3047.  source  code  from  a  library into his/her program.  Another feature of
  3048.  this program is that more than one instruction can be coded on one line,
  3049.  provided that the instructions are seperated by a semicolon.   When  the
  3050.  instructions are listed during exection, they will be listed on seperate
  3051.  lines.   As the code is being copied, it may simultaneously be modified.
  3052.  Another interesting feature is that BESTOP has several "canned"  program
  3053.  imbedded  within  it.   Most  notably is a update program.  All the user
  3054.  needs to code is the program invocation and suitable  parameters.   This
  3055.  update   program   can  handle  virtually  any  simple  sequential  file
  3056.  structure.  Other canned routines include a sequence checking routine, a
  3057.  dump and a file comparison routine.
  3058.  
  3059.         Example
  3060.  
  3061.   //UPD EXEC PGM=BESTOP,REGION=600K,PARM='T=1,A=1,B=3'
  3062.   //STEPLIB  DD  DISP=SHR,DSN=FEA.LINKLIB
  3063.   //SYSPRINT DD  SYSOUT=A
  3064.   //LISTING  DD  SYSOUT=V,FLASH=OUO
  3065.   //FILE1 DD DISP=(OLD,DELETE),DSN=&&UPD
  3066.   //FILE2 DD DSN=&&NEWM,UNIT=SYSDA,
  3067.   //  DISP=(NEW,PASS),SPACE=(CYL,(1,1),RLSE),
  3068.   //  DCB=(RECFM=FB,LRECL=80,BLKSIZE=6160)
  3069.   //FILE3 DD DISP=(OLD,DELETE),DSN=&&MSTR
  3070.   //PROGRAM  DD *
  3071.   @UPDATE K='1.1.22 3.1.22 1.30.36 3.30.36',               +
  3072.           T='23',S='37',E='80',L='80'
  3073.  
  3074.  
  3075.  ________________________________________________________________________
  3076.  
  3077.                                    -51-
  3078. 1
  3079.                                   BESTOP
  3080.  ________________________________________________________________________
  3081.  
  3082.  
  3083.         Notes:
  3084.  
  3085.         FILE1  is  the transaction file.  FILE3 is the old
  3086.         master file.  FILE2 is the updated master file.
  3087.  
  3088.         The key fields are the first 22 positions in  each
  3089.         file.  Each file must therefore be sorted on these
  3090.         positions.
  3091.  
  3092.         The  transaction  code  is  in  position 23 of the
  3093.         transaction file.  Valid codes and there  function
  3094.         are as follows:
  3095.  
  3096.              A,I - add/insert a record into the file
  3097.  
  3098.              C,R - change/revise a record
  3099.  
  3100.              D   - delete a record
  3101.  
  3102.              U   - add a record if the transaction key is
  3103.                    less than the master key, otherwise
  3104.                    change a record if the keys match.
  3105.  
  3106.         The  plus  sign indicates that this instruction is
  3107.         continued.
  3108.  
  3109.         "S"  indicates  the  start  of  the   data.    "E"
  3110.         indicates  the  end of the data, and "L" shows the
  3111.         record length.  If E=L, then E may by omitted.
  3112.  
  3113.         Revisions are performed in  the  data  area  only.
  3114.         This updated program assumes no prior knowledge of
  3115.         the  demarcation  of  data  fields.  Revisions are
  3116.         performed  on  a  character  by  character   basis
  3117.         according to the following rules:
  3118.  
  3119.              1.   If a character on the transaction record
  3120.              is blank,then the corresponding character  on
  3121.              the master file record will remain unchanged.
  3122.  
  3123.              2.   If  the  character  on  the  transaction
  3124.              record is  not  blank,  then  this  character
  3125.              replaces  the  corresponding character on the
  3126.              master file record.
  3127.  
  3128.              3.  The exception to  the  previous  rule  is
  3129.              that  if the transaction record has the value
  3130.              of the "BLANK"  variable  (default  is  "_"),
  3131.              then   the  corresponding  character  on  the
  3132.              master file record becomes blank.
  3133. 0
  3134.  ________________________________________________________________________
  3135.  
  3136.                                    -52-
  3137. 1
  3138.                                   BESTOP
  3139.  ________________________________________________________________________
  3140.  
  3141.  
  3142.         Only  the  first 130 characters of the transaction
  3143.         record will be listed.  The type of transaction is
  3144.         indicated  in  column   one  of  the  listing   as
  3145.         follows:
  3146.  
  3147.               "+" - this record has been added to the file
  3148.  
  3149.               "-"  -  this  recods  has  been deleted from
  3150.               the file
  3151.  
  3152.               "  "  -   this    is    a    revision/change
  3153.               transaction record
  3154.  
  3155.               ">"  - this is the original master record to
  3156.               be changed
  3157.  
  3158.               "<" - this id the changed master file record
  3159.  
  3160.               "*"  -  this  transaction   record   has   a
  3161.               processing error  (i.e.  a  matching  record
  3162.               exist  if  an  insert  was  attempted, or no
  3163.               matching   record  exists  if  a  delete  or
  3164.               change was attempted)
  3165.  
  3166.  
  3167.  
  3168.         Example
  3169.  
  3170.         Obtain  the  documentation  for the various canned
  3171.         programs
  3172.  
  3173.              @HELP HELP
  3174.  
  3175.         Get the description of the syntax for the sequence
  3176.         checking program
  3177.  
  3178.              @HELP SEQCHK
  3179. -
  3180. -
  3181. -
  3182. -
  3183. -
  3184.  ________________________________________________________________________
  3185.  
  3186.                                    -53-
  3187. 1
  3188.                                   BESTOP
  3189.  ________________________________________________________________________
  3190.  
  3191.  
  3192.         Example
  3193.  
  3194.         Copy  source  code  into a Bestop program prior to
  3195.         actual program execution.
  3196.  
  3197.  //DUMP   EXEC PGM=BESTOP,REGION=600K,PARM='I=1'
  3198.  //STEPLIB  DD DISP=SHR,DSN=FEA.LINKLIB
  3199.  //SYSPRINT DD SYSOUT=A
  3200.  //LISTING  DD SYSOUT=A
  3201.  //FILE1    DD DISP=OLD,DSN=CNaaaa.uuu.MASTER.FILE
  3202.  //MACROS   DD DISP=SHR,DSN=CNaaaa.uuu.BESTOP.SOURCE.LIB
  3203.  //PROGRAM  DD *
  3204.  
  3205.  *  LIST  STATES  ALABAMA  & ALASKA FROM THE MASTER FILE
  3206.  *  ALSO LIST STATE AND COUNTY NAMES
  3207.  *   1.3  =  STATE CODE, 1.6 = STATE & COUNTY CODE
  3208.  
  3209.  I  M  1.1.6  E  '010,020'
  3210.     M  1.1.80  L.1.80
  3211.     L S E       * LOOKUP STATE NAME
  3212.     L C E       * LOOKUP  CNTY  NAME
  3213.     W L 2
  3214.  
  3215.  T S 1.1.3  L.81.100       *  STATE  TABLE
  3216.  &STATES   SEL=(010),  SEL=(020)
  3217.  T  C  1.1.6 L.101.120     *  COUNTY NAMES
  3218.  &COUNTIES  SEL=(010), SEL=(020)
  3219.  
  3220.  
  3221.         Notes:
  3222.  
  3223.         The file defined by the DDName=MACROS  must  be  a
  3224.         partitioned dataset.  "STATES" and "COUNTIES"  are
  3225.         members of the PDS.
  3226.  
  3227.  
  3228.         To  include  data  from a member into the program,
  3229.         code an ampersand "&" in column 1 followed by  the
  3230.         member  name.   The included data may be qualified
  3231.         and/or modified during the copy operation. (For  a
  3232.         more   complete  description  of  this  mechanism,
  3233.         reference the documentation for the MACROS program
  3234.         written by Hans Becker (202-252-6874)).
  3235.  
  3236. -
  3237. -
  3238. 0
  3239.  ________________________________________________________________________
  3240.  
  3241.                                    -54-
  3242.